Setting Up Eclipse/IntelliJ for Selenium Projects (Java)
Setting Up Eclipse/IntelliJ for Selenium Projects (Java)
If you’re starting with Selenium automation in Java, one of the first things you need is a proper IDE setup.
This guide shows you how to set up Selenium in Eclipse and IntelliJ IDEA, step by step.
🧑💻 Prerequisites
Before you begin, make sure you have:
Java JDK installed (Java 8 or above)
Eclipse IDE or IntelliJ IDEA installed
Chrome Browser
ChromeDriver downloaded (must match your Chrome version)
🟡 Part 1: Setting Up Selenium in Eclipse
✅ Step 1: Create a New Java Project
Open Eclipse
Go to File > New > Java Project
Enter project name (e.g.,
SeleniumDemo)Click Finish
✅ Step 2: Create a Package and Class
Right-click
src> New > Package (e.g.,automation)Inside the package, create a Java class (e.g.,
LoginTest)Add
mainmethod:
✅ Step 3: Add Selenium JARs
Download Selenium JARs from: https://www.selenium.dev/downloads/
Extract the
.zipfileRight-click project > Build Path > Configure Build Path
Go to Libraries > Add External JARs
Add:
selenium-java-x.x.x.jarAll JARs inside the
libsfolder
Click Apply and Close
✅ Step 4: Add ChromeDriver to Your System Path
Extract
chromedriver.exePlace it in your project folder or any known path
Set system property in code:
✅ Step 5: Sample Selenium Code
🔵 Part 2: Setting Up Selenium in IntelliJ IDEA
✅ Step 1: Create a New Project
Open IntelliJ
Select New Project > Java
Set project name and location
Select JDK and click Finish
✅ Step 2: Add Selenium Libraries
Download Selenium Java JARs
Right-click on project > Open Module Settings (F4)
Go to Libraries > + > Java
Select:
selenium-java-x.x.x.jarAll JARs in the
libsfolder
Click Apply and OK
✅ Step 3: Create Java Class
Right-click
src> New > Java ClassName it (e.g.,
LoginTest)Add main method and Selenium code
✅ Step 4: Add ChromeDriver Path
Same as Eclipse — add this in your code:
✅ Step 5: Run the Code
Click the Run button or right-click > Run 'LoginTest'
You should see Chrome open and navigate to Google.
🧾 Final Thoughts
Whether you're using Eclipse or IntelliJ, the setup process is simple:
| Step | Eclipse | IntelliJ |
|---|---|---|
| Create project | Java Project | Java Project |
| Add JARs | External JARs in Build Path | Add Library in Module Settings |
| Create class | Java class in package | Java class in src |
| Run test | Main method | Main method |
Next Steps:
Learn element locators (ID, name, XPath)
Automate real-world test cases
Integrate with TestNG or JUnit
Comments
Post a Comment