Skip to main content

How to Run Your Tests Locally Against Chrome

Intro​

It's straightforward to get your tests running locally against Firefox. But when you want to run them against a different browser like Chrome, you quickly run into configuration overhead that can seem overly complex and lacking in code examples for getting started.

With the introduction of WebDriver (circa Selenium 2) a lot of benefits were realized (e.g. more effective & faster browser execution, no more single host origin issues, etc.). But with it came some architectural & configuration differences that may not be widely known. Namely -- browser drivers.

A Solution​

WebDriver works with each of the major browsers through a browser driver which is (ideally) maintained by the browser manufacturer. It is an executable file (consider it a thin layer or a shim) that acts as a bridge between Selenium and the browser.

ChromeDriver is Google Chrome's browser driver. In this specific use case is of using WebDriver with Chrome in testing locally.

Let's step through an example using ChromeDriver (download here).

Authors​

Dave Piacente
Original creator of Elemental Selenium
Diego Molina
Elemental Selenium maintainer