Hero Background

Next-Gen App & Browser Testing Cloud

Trusted by 2 Mn+ QAs & Devs to accelerate their release cycles

Next-Gen App & Browser Testing Cloud
  • Home
  • /
  • Blog
  • /
  • Learn To Run Selenium Tests On Chrome With Selenium ChromeDriver
AutomationSelenium Python

Learn To Run Selenium Tests On Chrome With Selenium ChromeDriver

Learn to download and setup Selenium ChromeDriver to effortlessly run Selenium tests on Chrome browser.

Author

Urwashi Priya

January 12, 2026

This article is a part of our Learning Hub. For more in-depth resources, check out our hub on Selenium Tutorial.

With an incredible 65.31% global market share when writing this blog, Google Chrome is undoubtedly the market leader. It is well-known for its abundant valuable features and is one of the most popular options for internet users globally. Keeping up with Chrome latest version is essential, as updates often introduce new functionalities and security enhancements. Due to its extensive use and impact, ensuring websites work well on Chrome is crucial to web development and testing.

This blog deep dives into Selenium testing specifically tailored for Chrome browsers. Before diving into the technicalities, we’ll first explore the fundamentals of ChromeDriver and guide you through the seamless configuration process on your Windows and MacOS systems.

Enhance your Automation Testing interview proficiency with our meticulously curated compilation of questions and answers. Explore the comprehensive list of Automation Testing Interview Questions and Answers for valuable insights.

What is Selenium ChromeDriver?

Selenium ChromeDriver is an open-source tool that enables Selenium WebDriver to automate interactions with the Chrome browser for testing web applications.

Initializing the ChromeDriver object can be done easily with the following command:

In Python.

from selenium import webdriver

driver = webdriver.Chrome()

In Java.

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;

WebDriver driver = new ChromeDriver
Note

Note: Automate your tests on a Selenium cloud grid of 3000+ real browsers. Try TestMu AI Today!

How to Download ChromeDriver for Selenium?

It is essential to know the version of Chrome running on your system and pick the ChromeDriver for Selenium that matches with it. ChromeDriver for Selenium can be downloaded from its official website.

Downloading Selenium ChromeDriver for version below or equal to 114.0

  • Download the required version of ChromeDriver from its official website.
  • Download the

    Note: Ensure that ChromeDriver and your browser’s version is same.

    Now, the question arises, how do you check your browser version?

    Click on the three dots in the top right corner of the Chrome browser. Go to option “Settings” and click on the “About Chrome” option.

    About Chrome
  • Extract the contents of the downloaded ZIP file to a location of your choice on your computer.

Downloading Selenium ChromeDriver for version 115.0 and above

After ChromeDriver version 114.0, the steps of installing were changed. Now, Google has launched Chrome For Testing Availability(CFTA) dashboard.

explicitly

A version of Chrome will be installed, used explicitly for automation testing.

  • Click on Stable and we will see a dashboard as shown below.
  • specification
  • Copy the URL according to your system specification, and the required version of Chrome and ChromeDriver gets installed.

This version of Chrome is used only for automation purposes and opens with this notification at the top.

compatible

Note: Only Selenium version 4.11.0 and above is compatible with Chrome browser version 115.0 and above. All the other steps remain the same.

Setting Up the ChromeDriver for Selenium

Let’s look at how to setup or configure the downloaded ChromeDriver for automation testing on Chrome with different systems.

Steps for Windows users

  • Open File Explorer and navigate to the extracted ChromeDriver folder.
  • Copy the path of the ChromeDriver executable file (ChromeDriver.exe).
  • Open the “About” section in the settings
  • Advanced
  • In the System Properties window, click on “Advanced system settings“. A pop-up window appears.
  • click
  • Click on the “Environment Variables” button.
  • Path
  • Under the “System variables” section, locate the “Path” variable and select “Edit.”
  • Click on “New” and paste the copied path of the ChromeDriver executable.
  • Click “OK” to save the changes, and ChromeDriver is now installed on your Windows system.

Once ChromeDriver is set up and configured, you can enhance your testing with KaneAI, a GenAI native test assistant by TestMu AI that integrates seamlessly with Selenium for Chrome automation.

KaneAI helps developers and testers by offering smart debugging and test generation features. With real-time insights, it can assist in identifying and resolving issues related to browser-specific behavior in Chrome, speeding up the testing process and improving accuracy.

...

Steps for Mac users

  • Once the download is complete, open the downloaded ZIP file.
  • In the Finder, press Command+Shift+G and enter “/usr/local/bin” to go to the bin directory.
  • Copy the extracted ChromeDriver executable file (ChromeDriver) into the “/usr/local/bin” directory.

Steps for Linux users

  • Extract the contents of the downloaded ChromeDriver ZIP file.
  • You can use the ‘unzip‘ command followed by the name of the ZIP file. For example: unzip ChromeDriver_linux64.zip.
  • Decide on a location where you want to store the ChromeDriver executable. It’s common to store it in the ‘/usr/local/bin’ directory, already in the system’s PATH.
  • To move the ChromeDriver executable to ‘/usr/local/bin’, use the following command: sudo mv ChromeDriver /usr/local/bin.
  • Once the ChromeDriver executable is moved, you need to make it executable. To grant executable permissions, run sudo chmod +x /usr/local/bin/ChromeDriver.

How to Check the Installed Version of Selenium ChromeDriver?

To check the installed version of Selenium ChromeDriver, one can follow these steps:

  • Open a terminal or command prompt.
  • Type the following command:
  • chromeDriver --version or chromeDriver -v`
    
  • The terminal will display the version number of the installed Selenium ChromeDriver.
  • without

Alternatively, one can run the command chromeDriver without additional arguments. This will start ChromeDriver, and the output will display the version information.

This command only works when that chromedriver is installed explicitly in the environment variables path.

NOTE: While working with specific ChromeDriver versions for compatibility, you might encounter challenges during the maintenance phase. Updates to browsers and WebDriver versions can lead to mismatches that result in test failures. When a newer version of the browser, your existing test scripts might not function as expected due to version discrepancies. Manual download and setup as discussed above can be automated to make the lives of the testers or developers easy, which will be discussed later in this blog.

Steps to Run Automation Test With Selenium ChromeDriver

This section will show how to run the test scripts on one’s system. Here we have written a simple script in Python and Java, which will open an “e-commerce playground”. This is a demo website maintained by TestMu AI to run tests and learn the concepts. This script will print the title of the website. In our example, it will print “Your Store”.

Writing a simple test script in Python

from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver.chrome.service import Service as ChromeService
import time
import os

# Set the specific path to the Chromedriver executable
chromedriver_path = "C:/Users/prati/Downloads/chromedriver_win32/chromedriver.exe"

# If the user has set the path in the environment variable, we can call in this way → chromedriver_path = os.environ.get(“Chromedriver_Path”)


# Create Chrome driver
options = webdriver.ChromeOptions()
service = ChromeService(executable_path=chromedriver_path)
driver = webdriver.Chrome(service=service, options=options)

# Open the website
driver.get("https://ecommerce-playground.lambdatest.io/")

#print the name of the title
title = driver.title
print(title)

driver.close()

Output:

script in Java

Writing a simple test script in Java

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeOptions;
import org.openqa.selenium.chrome.ChromeDriverService;

public class Main {

    public static void main(String[] args) {
        // Set the specific path to the Chromedriver executable
        String chromedriverPath = "C:/Users/prati/Downloads/chromedriver_win32/chromedriver.exe";

        // If the user has set the path in the environment variable, we can call in this way -> chromedriverPath = System.getenv(“chromedriver_Path”);

        // Create Chrome driver
        System.setProperty("webdriver.chrome.driver", chromedriverPath);
        ChromeOptions options = new ChromeOptions();
        ChromeDriverService service = new ChromeDriverService.Builder()
                .usingDriverExecutable(new File(chromedriverPath))
                .build();

        WebDriver driver = new ChromeDriver(service, options);

        // Open the website
        driver.get("https://ecommerce-playground.lambdatest.io/");

        // Print the title
        String title = driver.getTitle();
        System.out.println(title);

        // Close the driver
        driver.quit();
    }
}

Output:

procedure

Automating the Manual Process Of Managing Drivers

The pain of following the manual procedure. Selenium has used this concept to ship “Selenium Manager” out of the box as soon as you install the Selenium bindings. With Selenium Manager, you no longer have to worry about finding the right version, downloading it, setting it up, and maintaining it in the system path as it automates the steps involved.

We just need to write the following piece of code,

In Python:

driver = webdriver.Chrome()

In Java:

WebDriver driver = new ChromeDriver();

A Chrome’s driver object is instantiated, but this time, without having to download the driver binaries and mention a path as we saw in the manual procedure. This line of code works in a way such that it first identifies the current version of the browser, looks for a compatible driver in the environment, if found, uses it to instantiate the chrome driver object, otherwise, it downloads as per the version of chrome being used and manages it.

In Python

from selenium import webdriver

driver = webdriver.Chrome()
driver.get("https://ecommerce-playground.lambdatest.io/")
driver.quit()

In Java

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;

public class Example {
    public static void main(String[] args) {
        WebDriver driver = new ChromeDriver();
        driver.get("https://ecommerce-playground.lambdatest.io/");
        driver.quit();
    }
}
Note

Note: Automate your tests on a Selenium cloud grid of 3000+ real browsers. Try TestMu AI Today!

Steps to Run Automation Selenium Tests On TestMu AI Cloud Grid

To run your automation test on TestMu AI Cloud Grid, follow these steps:

1. Sign up for a TestMu AI account: Go to the TestMu AI website and sign up for an account if you still need to.

2. Retrieve your TestMu AI credentials: You can find these credentials in the “Automation” section of your TestMu AI account dashboard.

right Note: access key information is present on the right hand side.

3. Update your test code to integrate with TestMu AI: To generate capabilities, go to capability generator. Select the code for which you want to generate and paste it. Here’s an example of how you can modify your code:

import pytest
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver.chrome.options import Options as ChromeOptions
import time


@pytest.fixture
def driver(request):
    # Set the desired capabilities for LambdaTest Cloud Grid
    lt_options = {
        "build": "First build",
        "name": "First Test",
        "platformName": "Windows 10",
        "video": True,
        "w3c": True,  # informing latest Selenium 4 being used
        "browserName": "Chrome",
        "browserVersion": "114.0",
        "selenium_version": "4.9.0",
    }
    # Replace "YOUR_LAMBDATEST_USERNAME" and "YOUR_LAMBDATEST_ACCESS_KEY" with your actual LambdaTest credentials
    username = ""
    access_key = "xx"
    remote_url = "http://{}:{}@hub.lambdatest.com/wd/hub".format(username, access_key)
    browser_options = ChromeOptions()
    # adding the capability to the chrome
    browser_options.set_capability("LT:Options", lt_options)

    # Create the WebDriver instance with the desired capabilities
    driver = webdriver.Remote(command_executor=remote_url, options=browser_options)

    yield driver

    # Quit the WebDriver instance after the test completes
    driver.quit()


def test_scenario(driver):
    # Open the website
    driver.get("https://ecommerce-playground.lambdatest.io/")

    # Get the title of the page
    title = driver.title
    assert title == "Your Store"

    # Scrolling the entire webpage
    driver.execute_script("window.scrollTo(0, document.body.scrollHeight)")
    time.sleep(10)


    # Add assertions or additional steps as per your test scenario


if __name__ == '__main__':
    pytest.main()

Make sure to replace the placeholders (Your Build Name, Your TestMu AI Username, Your TestMu AI Access Key) with the appropriate values from your TestMu AI account.

This code is a Python script using the pytest testing framework and the Selenium framework to automate browser testing on the TestMu AI cloud platform. The purpose of this script is to demonstrate how to set up and perform automated tests on a website using the Selenium WebDriver and interact with the TestMu AI Cloud Grid for testing on different browsers and platforms.

Here’s a step-by-step code walkthrough:

  • Import Statements:
    The code starts with importing necessary libraries: pytest for testing and modules from Selenium for browser automation.
  • Fixture Definition (driver):
    The @pytest.fixture decorator defines a fixture named driver. A fixture is a way to set up and tear down resources needed for testing. Inside the fixture, the desired capabilities for the TestMu AI Cloud Grid are defined using the lt_options dictionary. These capabilities specify the browser, version, platform, test name, build information, and other options for the test.

Finally, a WebDriver instance is created using the webdriver.Remote class. The instance connects to the TestMu AI hub using the constructed remote URL and Chrome options.

  • Fixture Teardown:
    A yield statement is used, which means that the code after yield will run after the test is done executing.

In this case, the WebDriver instance is closed using driver.quit().

  • Test Scenario (test_scenario):
    The actual test is defined as a function called test_scenario that takes the driver fixture as an argument.

The test involves the following steps:

    • Opening a specific website using driver.get().
    • Getting the title of the webpage and asserting that it’s equal to “Your Store”.
    • Scrolling down the page using JavaScript (driver.execute_script()).
    • Performing a hover action over an element on the page using ActionChains.
    • Adding some wait time using time.sleep() to simulate interactions and visual checks.
    • The test is followed by a comment suggesting that more assertions or steps can be added based on the test scenario.
  • Main Execution:

The script’s main block is wrapped in an if __name__ == ‘__main__’: condition to ensure that its code is only executed when the script is run directly (not when imported as a module). It invokes the pytest.main() function to run the test.

4. Run the test with TestMu AI integration: Execute the following command in the terminal to run your test code with the TestMu AI integration:

pytest name_of_your_test.py

5. Review test results: Once the test run is complete, you can review the test results and logs on the TestMu AI dashboard. You’ll be able to see the screenshots, video recordings, and other details related to the test execution.

 test run test run p

That’s it! Your automation test will now run on the TestMu AI Cloud Grid using the desired capabilities you specified.

Conclusion

In conclusion, Selenium ChromeDriver is a vital tool for automating web browser interactions, enabling precise testing and validation of web applications. The introduction of Selenium Manager streamlines the manual process of ChromeDriver management, making setup and maintenance more efficient.

Through Selenium Manager, ChromeDriver version compatibility challenges are alleviated, allowing for seamless automation. Integration with the TestMu AI Cloud Grid expands testing coverage across diverse browsers and platforms. As the realm of automation evolves, a solid grasp of Selenium ChromeDriver and its efficient management is crucial for delivering high-quality web applications.

Author

Urwashi is a passionate software engineer with a knack for crafting elegant solutions to complex problems. With a deep understanding of cutting-edge technologies and a strong desire to share knowledge, she is a dedicated professional in the tech industry. Her expertise lies in creating engaging and insightful blog posts that provide valuable insights into the world of software engineering.

Frequently asked questions

Did you find this page helpful?

More Related Hubs

TestMu AI forEnterprise

Get access to solutions built on Enterprise
grade security, privacy, & compliance

  • Advanced access controls
  • Advanced data retention rules
  • Advanced Local Testing
  • Premium Support options
  • Early access to beta features
  • Private Slack Channel
  • Unlimited Manual Accessibility DevTools Tests