Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
in DevOps and Agile by (19.7k points)

Hi I am planning to setup selenium to test my web application.

I have read that both chromedriver and Xvfb can be used to run the tests. I have also read that Xvfb can be configured to use chromdriver.

So that got me confused. What role does chromedriver and Xvfb in running the selenium tests?


1 Answer

0 votes
by (62.9k points)

Let us first understand the difference chromedriver and xvfb and then a code snippet will make it more clear.

  1. chromedriver - to run tests on chrome browser (with GUI).

  2. Xvfb - to run tests in headless mode. Can be any browser including chrome (Browser graphical user interface will not be displayed, thus you can use the machine for a few different operations).


code snippets (python):

Chrome Driver (download here):

browser = webdriver.Chrome() // to launch tests in Chrome browser.

Xvfb - using pyvirtualdisplay (python wrapper for Xvfb) :

from pyvirtualdisplay import Display

from selenium import webdriver

display = Display(visible=0, size=(800, 600))


# now Chrome will run in a virtual display. 

# you will not see the browser.

browser = webdriver.Chrome()


print browser.title



Browse Categories