Selenium Chrome Driver

How WebDriver Works With Selenium ChromeDriver

When you want to run functional tests against Chrome you can easily encounter set-up overhead that appears to be really complex. Luckily, the advent of WebDriver makes this simpler.  WebDriver interacts with the Chrome via ChromeDriver. It is an executable file that serves as a connection between Selenium and the Chrome browser.

Here are the steps you need to use Selenium with ChromeDriver:

  • Download the most current ChromeDriver binary executable
  • Tell Selenium how to locate ChromeDriver, either by calling it in the Selenium setup or launching ChromeDriver and connecting to it with Selenium Remote
  • Pull in the required libraries (e.g., selenium-webdriver to automate Chrome and rspec/expectations & RSpec::Matchers to assert the test result) and creating your setup, run, and teardown methods.
  • Write your test and assertion

Note that the launching ChromeDriver from the command line will be faster than specifying it in the Selenium setup because ChromeDriver is up and running and your test just needs to connect to it (the other approach launches and shuts down ChromeDriver for each test).

For more details on how to use Selenium, download our Bootcamp guide today!