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.
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.
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…’.
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.
6) To verify Selenium WebDriver configuration, write “WebDriver driver;” inside the class.
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.
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.
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 :
- How to Create a Project in Eclipse
- How Automated Testing Tools Work
- What is Selenium
- What is Selenium WebDriver