Tuesday, November 4, 2025

thumbnail

How to Install and Configure Eclipse for Selenium Testing

## ๐Ÿงฐ **How to Install and Configure Eclipse for Selenium Testing**


Eclipse is one of the most popular **Integrated Development Environments (IDEs)** used for Java development and Selenium automation.

Below are the complete steps to install and set it up for Selenium testing.


---


## ๐Ÿชœ **Step 1: Install Java Development Kit (JDK)**


### **1. Download JDK**


* Go to the official Oracle website:

  ๐Ÿ”— [https://www.oracle.com/java/technologies/downloads/](https://www.oracle.com/java/technologies/downloads/)

* Choose the latest version of **JDK** suitable for your operating system (Windows, macOS, or Linux).


### **2. Install JDK**


* Run the downloaded installer.

* Follow the on-screen instructions to complete installation.


### **3. Set Environment Variables (Windows only)**


* Open **System Properties → Advanced → Environment Variables**.

* Under *System Variables*, find `Path` and click **Edit**.

* Add the JDK bin path, for example:


  ```

  C:\Program Files\Java\jdk-21\bin

  ```

* Verify installation by opening **Command Prompt** and typing:


  ```

  java -version

  ```


  You should see the installed version.


---


## ๐Ÿชœ **Step 2: Download and Install Eclipse IDE**


### **1. Download Eclipse**


* Visit the official Eclipse website:

  ๐Ÿ”— [https://www.eclipse.org/downloads/](https://www.eclipse.org/downloads/)

* Download **Eclipse IDE for Java Developers**.


### **2. Install Eclipse**


* Extract or install the downloaded package.

* Launch Eclipse by running the `eclipse.exe` file (on Windows) or app (on macOS).

* Choose a **workspace folder** (this is where your Selenium projects will be saved).


---


## ๐Ÿชœ **Step 3: Download Selenium WebDriver**


### **1. Go to the Selenium Official Website**


* Visit:

  ๐Ÿ”— [https://www.selenium.dev/downloads/](https://www.selenium.dev/downloads/)


### **2. Download Selenium Java Client Library**


* Under **Selenium Client & WebDriver Language Bindings**, click **Download** under **Java**.

* This will download a `.zip` file (e.g., `selenium-java-4.x.x.zip`).


### **3. Extract Files**


* Extract the ZIP file to a known location (e.g., `C:\Selenium`).


---


## ๐Ÿชœ **Step 4: Configure Selenium WebDriver in Eclipse**


### **1. Create a New Java Project**


* Open Eclipse.

* Go to **File → New → Java Project**.

* Enter a name, e.g., `SeleniumDemo`, and click **Finish**.


### **2. Add Selenium JAR Files**


* Right-click your project → **Build Path → Configure Build Path**.

* Go to the **Libraries** tab → click **Add External JARs**.

* Navigate to the folder where you extracted Selenium.

* Add **all .jar files** from:


  * The main `selenium-java-x.x.x` folder

  * The `libs` subfolder

* Click **Apply and Close**.


---


## ๐Ÿชœ **Step 5: Download and Set Up Browser Drivers**


Selenium WebDriver needs a **browser driver** to interact with browsers.


### **For Google Chrome:**


1. Go to: [https://chromedriver.chromium.org/downloads](https://chromedriver.chromium.org/downloads)

2. Download the version that matches your installed Chrome browser.

3. Extract the driver (`chromedriver.exe`) and place it in a folder like:


   ```

   C:\Selenium\drivers\

   ```


### **For Firefox:**


* Download **GeckoDriver** from: [https://github.com/mozilla/geckodriver/releases](https://github.com/mozilla/geckodriver/releases)


### **For Edge:**


* Download **Edge WebDriver** from: [https://developer.microsoft.com/en-us/microsoft-edge/tools/webdriver/](https://developer.microsoft.com/en-us/microsoft-edge/tools/webdriver/)


---


## ๐Ÿชœ **Step 6: Write Your First Selenium Test**


Here’s a simple **Java Selenium test script** to verify everything works:


```java

import org.openqa.selenium.WebDriver;

import org.openqa.selenium.chrome.ChromeDriver;


public class FirstSeleniumTest {

    public static void main(String[] args) {

        // Set the path to the ChromeDriver

        System.setProperty("webdriver.chrome.driver", "C:\\Selenium\\drivers\\chromedriver.exe");


        // Initialize WebDriver

        WebDriver driver = new ChromeDriver();


        // Open a website

        driver.get("https://www.google.com");


        // Print the title of the page

        System.out.println("Page title is: " + driver.getTitle());


        // Close browser

        driver.quit();

    }

}

```


### **To Run the Test:**


* Save the file → Right-click inside the code editor → **Run As → Java Application**.

* Chrome should open, load Google, print the title, and then close.


---


## ๐Ÿชœ **Step 7: Verify Setup**


If your test runs successfully and you see the browser launch, congratulations — your **Eclipse and Selenium setup is complete!** ๐ŸŽ‰


---


## ⚙️ **Optional: Useful Plugins for Eclipse**


To enhance your Selenium experience:


* **TestNG plugin** → for structured testing and reporting

* **EclEmma** → for code coverage

* **Maven integration (m2e)** → for dependency management


---


## ✅ **In Summary**


| **Step** | **Action**               | **Purpose**                     |

| -------- | ------------------------ | ------------------------------- |

| 1        | Install JDK              | Enables Java programming        |

| 2        | Install Eclipse          | Development environment         |

| 3        | Download Selenium        | Core automation libraries       |

| 4        | Add JARs to Eclipse      | Link Selenium with your project |

| 5        | Download Browser Drivers | Enables browser interaction     |

| 6        | Write & Run Test         | Verify setup works              |


---


Would you like me to include the **TestNG setup and configuration in Eclipse** next (for running multiple Selenium tests with reports)?


Learn Selenium with JAVA Training in Hyderabad

Read More

Benefits of Using Selenium for Test Automation

What is Automation Testing? An Introduction with Selenium

Visit Our Quality Thought Institute in Hyderabad

Get Directions


Subscribe by Email

Follow Updates Articles from This Blog via Email

No Comments

About

Search This Blog

Powered by Blogger.

Blog Archive