How to execute WebDriver Script in Chrome Browser ?

In order to execute selenium script on Chrome browser, first you have to download the ChromeDriver server.

ChromeDriver is supported by the Google Chromium team and it can be downloaded from

For windows environment, you will have to download the following version :


As ChromeDriver is a separate executable file which selenium uses to communicate with Chrome browser.

Selenium code interacts with ChromeDriver server through JSON wire Protocol and then ChromeDriver will further communicate with chrome browser. So basically, chrome driver will act as a bridge between selenium code and Chrome Browser. Just have a look at below picture :


Command to setup ChromeDriver path in your selenium code

System.setProperty("", "chromedriverpath/chromedriver.exe");

And if you try to execute you selenium code on Chrome Browser without setting up the path of ChromeDriver Server in your code, you will end up with following error :

Exception in thread "main" java.lang.IllegalStateException: The path to the driver executable must be set by the system property; for more information, see The latest version can be downloaded from
	at org.openqa.selenium.remote.service.DriverService.findExecutable(
	at org.openqa.selenium.remote.service.DriverService$

Sample Script

import org.openqa.selenium.WebDriver;

public class Test1 {

	public static void main(String[] s) throws InterruptedException {
		// Set chrome driver path
		System.setProperty("", "D:/workspace/SampleProject/driver-servers/chromedriver.exe");

		// Initialize Chrome Driver
		WebDriver driver = new ChromeDriver();

		// Launch Facebook on Chrome Browser

		// Wait for 5 seconds

		// Close Browser


If you really like the information provided above, please don’t forget to like us on Facebook, you can also leave the comment.

Leave a Reply

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