App & Browser Testing Made Easy

Give your users a seamless experience by testing on 3000+ real devices and browsers. Don't compromise with emulators and simulators

Home Guide How to run Selenium tests on Chrome using ChromeDriver?

How to run Selenium tests on Chrome using ChromeDriver?

By Sonal Dwivedi, Community Contributor -

Google Chrome dominates the browser market with a massive 64% global market share. With several useful features, it is one of the most preferred browsers in the world. Given its importance and usage, testing all websites on Chrome becomes crucial.

This article will explain how to perform Selenium tests on a Chrome browser using ChromeDriver. But before that, let’s understand what ChromeDriver is and how users can configure it on their systems.

What is a Selenium ChromeDriver?

A ChromeDriver is a standalone server or a separate executable used by Selenium WebDriver to control Chrome. Running Selenium test scripts on the Google Chrome browser is impossible without ChromeDriver. One can easily initialize the object of ChromeDriver using the following command:

WebDriver driver = new ChromeDriver

How to download ChromeDriver for Selenium?

You can download ChromeDriver for Selenium as per the ChromeDriver version using its official website. Here are the steps given below:

Steps to download ChromeDriver version 115 and above

  1. Navigate to ChromeDriver official site for downloading the latest ChromeDriver. Download ChromeDriver version 115
  2. For Chrome browser version 115 and above, click on “the Chrome for Testing availability dashboard” which will navigate to Chrome for Testing Dashboard. Chrome for Testing availability dashboard
  3. This page has various versions for Stable, Beta, Dev and Canary releases for Windows, Mac and Linux operating system. Click on Stable link and look for ChromeDriver Win32 or Win64 (based on the Windows OS system type). ChromeDriver 64
  4. Open the URL in the new browser window and ChromeDriver will be downloaded in zip format. Extract the content and move it to the desired location. (Preferably at the root location of the automationproject). chromedriver path

Steps to download ChromeDriver version 114 and below

  1. Navigate to ChromeDriver official site which lists all the latest and previous versions of ChromeDriver.
  2. Based on the Chrome browser version available on the system download the respective ChromeDriver. Assuming current Chrome browser version to be 114, click on “ChromeDriver 114.0.5735.90”. This page will navigate to the download section which has drivers for Mac, Linux, and Windows.
  3. Assuming the current system is Windows, click on “”. Chromedriver 114 windows
  4. ChromeDriver will be downloaded in zip format. Extract the content and move it to the desired location. (Preferably at the root location of the automation project).

Now, we have the desired ChromeDriver downloaded depending on our Chrome browser version, let us see the 2 ways by which we can configure ChromeDriver via environment and System.setProperty() method of Java.

How to configure ChromeDriver?

You can configure ChromeDriver using different methods

Steps to configure ChromeDriver via Environment Variable

On Windows operating systems, we can declare system level variables by using Environment variables. Below steps will help you set up the environment variable for Chrome Driver. Whenever an instance of the WebDriver is created in Selenium script, it will automatically detect the path of the ChromeDriver from the system variables.

  1. After the ChromeDriver executable file is extracted and moved to the desired location, copy that location to set its path in System’s environment variables.
  2. Open Environment variable pop up by directly searching for “Environment Variables” from Windows Search. This will open “System Properties” pop up. Click on the “Environment Variables” button. Configure Chrome with Environment Variable
  3. On Environment Variables pop-up’s System Variables section, click on Path variable and click on the Edit button.  Edit Path Variable to configure ChromeDriver
  4. On the Edit environment variable pop-up, click on the “New” button and add the ChromeDriver executable location. Click on OK to save the configuration. New Path variable to configure chrome
  5. Now whenever we create an instance of ChromeDriver in the Selenium script, it will automatically detect the ChromeDriver path from the system variable.
driver = new ChromeDriver();

This will automatically detect the ChromeDriver path from the system variable.

Configure ChromeDriver via System.setProperty method

ChromeDriver can also be configured by explicitly specifying the ChromeDriver path in the test script.

System.setProperty accepts key value pair where key would be “” and value would be the path of the ChromeDriver exe path.

System.setProperty("", "D:\\BStackDemo\\chromedriver.exe");

Steps for macOS users:

  1. Go to the terminal and type the command: sudo nano /etc/paths
  2. Enter the password
  3. At the bottom of the file, add the path of your ChromeDriver
  4. Type Y to save
  5. To exit press Control + C

Steps to run Selenium Tests on Chrome Browser

Let’s discuss how to run Selenium scripts on a Chrome browser using ChromeDriver.

  1. In Eclipse or any IDE, create a Java project and add Selenium Java jars in the Java build path section.
  2. Create a Java class file and add the below code to launch BStackDemo application on Chrome browser.
  3. Set the properties by specifying the type of driver to be used along with its path describing where it is stored.
  4. Initialize the object of the ChromeDriver. This helps in launching the Chrome browser.
  5. To navigate to a particular URL, use the driver.get() method. One can also locate certain web elements using specific locators. To know more about locating elements in Selenium, refer to this detailed guide on Locators in Selenium.

Pro Tip: Want to dive deeper into Selenium implementation on BrowserStack with free interactive courses and lab exercises? Visit Test University

Now let’s consider a test case example wherein we want to perform 2 simple steps:

  1. Open Chrome Browser
  2. Go to

Did you know: There are more than 98 Chrome Browser versions to test on. Don’t miss out on testing across!

Refer to the code snippet below to get a better sense of executing the steps mentioned above:

import org.openqa.selenium.WebDriver;

public class ChromeTest {

public static void main(String args[]) {

WebDriver driver;

//Setting system properties of ChromeDriver 
System.setProperty("", "D:\\BStackDemo\\chromedriver.exe");

//Creating an object of ChromeDriver
driver = new ChromeDriver();

//launching the specified URL 

If you are configuring ChromeDriver via the environment variable, delete the System.setProperty() line from the above code and it should work.

Run Selenium Tests using ChromeDriver

  • Although it’s vital to test web-apps for Chrome, it’s also important for a web app to be optimized for other browsers like Firefox, Safari, Edge, etc.
  • Teams can leverage  BrowserStack, which enable QAs to perform cross browser testing for their web apps across thousand of real browsers and browser versions like Safari, Opera, Edge, etc.
  • All real browsers are installed on real desktop and mobile devices, thus providing the optimal environment for software testing in real user conditions.

Frequently Asked Questions (FAQs)

1. How to use Selenium WebDriver ChromeDriver?

The following are the steps to use Selenium WebDriver ChromeDriver:

  1. Download and install the latest version of ChromeDriver.
  2. Install the Selenium WebDriver client for your programming language (e.g., Python, Java, Ruby).
  3. Import the necessary packages in your code to use Selenium WebDriver and ChromeDriver.
  4. Create a new instance of ChromeDriver in your code.
  5. Use the instance to automate actions in the Chrome browser (e.g., navigating to a URL, filling out a form).

2. Are there any prerequisites for using Selenium WebDriver ChromeDriver?

Yes, you need to have a basic understanding of a programming language and its syntax. You must also have installed the latest versions of Chrome browser, ChromeDriver, and Selenium WebDriver client for your chosen programming language.

3. Which Selenium WebDriver do we need to execute tests in the Chrome browser?

  • To execute tests in the Chrome browser using Selenium WebDriver, you need to use ChromeDriver.
  • ChromeDriver is a separate executable used by Selenium WebDriver to control the Chrome browser.
  • Download the latest version of ChromeDriver and control the Chrome browser during your tests.
  • Use the version of ChromeDriver that matches the version of your Chrome browser.
Selenium Selenium Webdriver

Featured Articles

Chrome vs Chromium: Core Differences

Exception Handling in Selenium WebDriver

Curated for all your Testing Needs

Actionable Insights, Tips, & Tutorials delivered in your Inbox
By subscribing , you agree to our Privacy Policy.
thank you illustration

Thank you for Subscribing!

Expect a curated list of guides shortly.