Setup a Selenium WebDriver Project in Eclipse

Last updated on - August 29th, 2018

In our previous article, we talked about steps to create a project in Eclipse, to run Java programs. Further, you can configure (install) Selenium WebDriver libraries in the same project to extend the capabilities of the project to run Selenium WebDriver programs.

This article is in continuation of the previous article – creating a project in Eclipse. So, I assume, you already know the steps to create a new project in Eclipse and you also know the steps to create packages and classes in Eclipse.

Setup a Selenium WebDriver Project in Eclipse

Selenium WebDriver is one of the popular automation tools (libraries). In this article, we are going to explore Selenium WebDriver step by step configuration details to run Selenium WebDriver code.

You can also say, this article is all about exploring how to install Selenium WebDriver. Good point to note here is steps for installing Selenium Webdriver on MAC system and Windows system is same.

Here, Selenium installation guide is majorly segregated into two parts – downloading the libraries and add those libraries to Java build path in Eclipse project.

1) Download Selenium WebDriver Libraries
2) Add Jars to Java Build Path in Eclipse

Download Selenium WebDriver Libraries

1) Navigate to Selenium official website and move to section “Selenium Client & WebDriver Language Bindings“.

2) Download Selenium WebDriver latest version for Java language as a part of this exercise and save it in your project root folder in the workspace.

If you want to work with any other programming language, you can download respective language bindings like C#, Ruby, Python etc.

Selenium Webdriver Language Binding

Add Jars to Java Build Path In Eclipse

3) Right click on Project ‘JavaProjectDemo‘ and select ‘Properties’ > ‘Java Build Path’. Move to ‘Libraries’ tab and click on  ‘Add External JARs…’.

Java Build Path Libraries Tab

4) Browse to Selenium WebDriver Java libraries folder that you have downloaded in step no-2. Add all the files having an extension ‘.jar’. Click on ‘Apply‘ and ‘Ok‘.

5) Once you add all the Jars to the project in Eclipse, ‘Referenced Libraries‘ shows all the added jars in the project.

Likewise, you can also import other third party libraries like Apache POI (to read data from excel), TestNG etc as per your requirement.

Referenced Libraries in Eclipse Project

6) To verify Selenium WebDriver configuration, write “WebDriver driver;” inside the class.

Verifying Selenium WebDriver configuration

7) Currently, red-line is showing for word ‘WebDriver‘. Hover your mouse to ‘WebDriver’ to resolve the error. IntelliSense window will show you all the available quick fixes.

Import WebDriver Package Suggestion



8) If Selenium WebDriver configuration is done properly, IntelliSense window will show “import ‘WebDriver’ (org.openqa.selenium)“. 

Click on it to import relevant package and good to go ahead.

Imported WebDriver Package in Eclipse

Now, your project is ready to write first Selenium WebDriver test script and automate web applications.

I hope this article helped you to setup a Selenium WebDriver project in Eclipse. Further, you can also read other related articles.

Let me know if you have any questions. Share your thoughts in the comment section.

Do you know someone who can benefit from the information in the article? Share it with them on Facebook, LinkedIn, Twitter or Google Plus.

For Further Reading :

About Suresh Dubey

I am Suresh Dubey working as an automation test engineer. I am passionate about playing with automation testing and tools. I got a chance to work on Selenium, UFT, PowerShell, Jenkins, CI-CD, Maven, Cucumber, Git etc. I believe in 'Knowledge Sharing'. My mantra for success is 'Learn Something New Everyday'.

View all posts by Suresh Dubey →

One Comment on “Setup a Selenium WebDriver Project in Eclipse”

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.