## ๐งฐ **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
Subscribe by Email
Follow Updates Articles from This Blog via Email
No Comments