Running Selenium test case in Google Chrome?

We have already learned to execute selenium test case in Firefox browser . Now we thought of running the same test on “Google Chrome”.

Requirement:- Executing selenium webdriver test case in Google chrome for the first time.

We simply tried to change the previous code and passed the reference of “chromedriver”.

Before :-
  WebDriver driver = new FirefoxDriver();
  WebDriver driver = new ChromeDriver();

But !!!

On our execution of the test case we encountered a below error message:-

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 at org.openqa.selenium.remote.service.DriverService.findExecutable( at at at LearnSelenium.main(

This error message was a hint for our solution. We followed this to solve the puzzle of running our test on chrome.

Step1:- We need to download the “ChromeDriver“(Given in the above error message)
Link :–

Chromedriver download
Download the latest version 

ChromeDriver for selenium
Check the OS

 We can check the latest bug fixes from notes.txt
 For other Drivers download 

Step2:– Extract the file (chromedriver.exe)

Step3:-We need to use the “System Property” to create a bridge between the selenium webdriver and google chrome.

 Key = “”
 Value = “chromedriver.exe”, Absolute path of chromedriver , (Refer Step-2 above)


import org.openqa.selenium.WebDriver;
import java.lang.*;
import org.openqa.selenium.firefox.FirefoxDriver;
public class LearnSelenium {

public static void main(String[] args) {
//Creating WebDriver Object
System.out.println("Launching the Browser");
//WebDriver driver = new FirefoxDriver();
System.setProperty("", "D:\Automation\Selenium\MyCode\chromedriver_win32\chromedriver.exe");
WebDriver driver = new ChromeDriver();
//Opens the given URL
System.out.println("Fetching the Title");
System.out.println("Please Wait!!");
//Returns the Title of Current Page
String sTitle = driver.getTitle();
System.out.println("My First Selenium Program");
System.out.println("Title is = '"+sTitle+"'" );
//Closing the Browser


Some crucial tips for selenium automation testing

4 replies on “Running Selenium test case in Google Chrome?”

Leave a Reply to ramesh puvvadi Cancel reply

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