Flash Sale:75% Off Hosting + Free DomainEnds in13h47m14sView Plans
Hostvento logoHostvento

Install Selenium WebDriver on Windows (Java and Eclipse)

Set up the JDK, the Eclipse IDE and the Selenium Java library, or use pip for Python.

Windows Hosting2 min read5 steps18 screenshots

Step 1: Install the JDK

Download the Java Development Kit from the Oracle site (or an OpenJDK build) and install it.

Downloading the JDK
Installing the JDK

Check it in Command Prompt:

java -version
Verifying Java

Step 2: Install the Eclipse IDE

Download Eclipse IDE for Java Developers from the Eclipse website. Choose the version for your Windows architecture (64-bit in most cases).

Downloading Eclipse
Confirming the Eclipse download

Extract the downloaded zip (or run the installer).

Extracting the download

Start Eclipse.

Launching Eclipse

Choose a workspace folder.

Selecting a directory

Step 3: Download the Selenium Java client

Go to the Selenium website, open Downloads and download the Java client (a zip file).

Downloading Selenium

Extract it to a folder such as C:\selenium. It contains the .jar files and a libs folder.

Extracting the Selenium files

Step 4: Configure Eclipse with WebDriver

  1. Create a Java project: File, New, Java Project. Name it and click Finish.
    Configuring Eclipse
    Creating a Java project
    Naming the project
  2. Open the project properties (right-click the project, Properties) and go to Java Build Path.
    The project properties
    Configuring the build path
  3. On the Libraries tab click Add External JARs. Select the Selenium jar file.
    Adding the Selenium jar file
  4. Add the jar files from the libs folder too.
    Adding all the jar files
  5. Click Apply and Close.
    Verifying the setup

Step 5: Add a browser driver

Modern Selenium (4.6 and later) downloads the driver for Chrome, Firefox and Edge by itself with Selenium Manager. For older versions, download chromedriver.exe and set its path in your code.

A first test

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

public class FirstTest {
    public static void main(String[] args) {
        WebDriver driver = new ChromeDriver();
        driver.get("https://example.com");
        System.out.println(driver.getTitle());
        driver.quit();
    }
}

Run it with the green Run button.

Selenium for Python

If you prefer Python, install Python and then:

pip install selenium

A first test:

from selenium import webdriver

driver = webdriver.Chrome()
driver.get("https://example.com")
print(driver.title)
driver.quit()

Quick recap

  • Install the JDK and Eclipse.
  • Add the Selenium jar files to the build path.
  • Or use pip install selenium for Python.