Home | Tutorials | Selenium WebDriver | How to launch Chrome browser in Selenium WebDriver?

How to launch Chrome browser in Selenium WebDriver?

Webdriver is the interface in API, which has several implementations. We mainly write test cases against those implementations only. HTMLDriver, FirefoxDriver, OperaDriver, ChromeDriver, InternetExplorerDriver, etc are the implementations to WebDriver interface. Today we will discuss ChromeDriver to launch chrome browser to run test cases in Selenium webdriver.

ChromeDriver is basically a project of Chromium.

How to implement ChromeDriver to launch Chrome Browser?

We can implement ChromeDriver in a just a single line of code, but that is not sufficient. WebDriver API does not have a native implementation for Chrome browser so we need additional Google Chrome Driver file. It is an executable file like Geckodriver that we discussed in the previous chapter. So we need to set the property in the system for Google Chrome Driver first.

Architechture of Chrome Driver and chrome browser
Image Credit: AssertSelenium Blog


How does Google Chrome Driver work?

Google Chrome Driver makes a server in your local system. So IDE (Eclipse or IntelliJ) first connect with Chrome driver and then driver communicates with Chrome browser in its native language, further, ChromeDriver sends commands mentioned in test cases to Chrome browser. Thus, like this ChromeDriver acts as a middle man or proxy between Test cases and Chrome browser.


Download Google Chrome Driver executable file

Visit Selenium download page, after scroll down you find the list of all the executable files of all the drivers.

The current version of ChromeDriver is 2.31 for Selenium 3.0.4.

Download ChromeDriver

 Chromedriver to launch chrome browser

Java code to implement ChromeDriver in Selenium to launch Chrome browser

You need to define Set Property before implementing ChromeDriver. So here is the easy to understand code snippet for you.


TIP: Right click with Shift on ChromeDriver.exe file and select “Copy as Path”. Entire path will be copied automatically. Then paste the path in code and replace single slash with the double slash. See screenshot below:

Path to chromedriver to set up chrome browser in java



So the ChromeDriver implementation looks like this:


Code snippet to launch www.inviul.com in Chrome browser by using ChromeDriver.



About Avinash Mishra

Avinash Mishra is the author of Inviul blog. He is a software engineer and blogger by choice. He loves to write blogs, and apart from blogging, he is interested in documentary film making, listening to music, traveling around the world and philanthropic activities.

Check Also

Selenium 3 Inviul Geckodriver

GeckoDriver: FAQs & Set up Guide in Selenium 3 for Latest Firefox

An Older version of Selenium like Webdriver 2.51 is working fine till Mozilla Firefox version …

Leave a Reply

Your email address will not be published. Required fields are marked *