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 runnning the selenium tests.
Thanks
Xvfb (short for X virtual framebuffer) is an in-memory display server for UNIX-like operating system (e.g., Linux). It enables you to run graphical applications without a display (e.g., browser tests on a CI server) while also having the ability to take screenshots.
WebDriver is an open source tool for automated testing of webapps across many browsers. It provides capabilities for navigating to web pages, user input, JavaScript execution, and more. ChromeDriver is a standalone server that implements the W3C WebDriver standard.
Why do you need ChromeDriver? The main purpose of the ChromeDriver is to launch Google Chrome. Without that, it is not possible to execute Selenium test scripts in Google Chrome as well as automate any web application. This is the main reason why you need ChromeDriver to run test cases on Google Chrome browser.
ChromeDriver uses the same version number scheme as Chrome. See https://www.chromium.org/developers/version-numbers for more details. Each version of ChromeDriver supports Chrome with matching major, minor, and build version numbers. For example, ChromeDriver 73.0.
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))
display.start()
# now Chrome will run in a virtual display.
# you will not see the browser.
browser = webdriver.Chrome()
browser.get('http://www.google.com')
print browser.title
browser.quit()
display.stop()
References:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With