Create a Java Project and Install Selenium Webdriver in Eclipse
Selenium is an automation tool that allows to automate the functionality of the project or module and test. Once test completes selenium provides complete detailed report, so that you could analyze and suggest to fix the issues or bugs. Selenium comes with Selenium IDE, Selenium Remote Control and Selenium Webdriver.
Selenium Webdriver is a flexible and open source functional testing tool. With Selenium Webdriver you can run script in Eclipse and write your script according to the requirements and generate the detailed report.
Please follow the steps to create java project and install Selenium Webdriver in Eclipse.
1) Download Eclipse – Click Here
2) Download Selenium Webdriver Java (2.xx.x)– Click Here
3) Make sure Java is installed in your system and correct path is set. If Java will not be installed in your system you will not be able to open Eclipse.
4) To check whether java is installed in your system please Click to the Start and type cmd in search text box and hit Enter:
5) On command prompt type java –version will display the current java version installed in your system.
6) If Java is not installed please install Java – Click Here
7) Now open Eclipse folder and double click on the Eclipse icon to start Eclipse.
8) Once Eclipse starts successfully will ask you to provide work location. You can provide work location or you can leave as it is to select Eclipse default work location.
9) Click OK button to continue.
10) Go to File -> New -> Project and click on Project.
11) Click on Java Project and then click on Next button.
12) Provide the project name and click on Next.
13) Finally click on Finish to add the project in Eclipse.
14) In this project, Class will not be added so lets add the class so that you could write your code.
15) Right click on src under project shown on left side and click on New -> Class
16) In java class window provide Package name, Class name and click on Check-box “public static void main”.
17) Click on Finish will add the class in the project.
Interface will look like this:
18) Under class you can start writing your script.
Here project is create and class have been added successfully. Now let’s install Selenium Web Driver.
1) Make sure you have downloaded Selenium Webdriver and unzipped it. Remember the folder location saved in your system.
2) Right Click on project -> Build Path and click on Configure Build Path.
3) Click on Library tab and then click on Add External JARs…
4) Select all the .jar files and click on Open.
5) Again click on Add External JARs… and then double click on libs folder.
6) Select all the .jar files by clicking Ctrl+A (Select all) and again click on Open.
7) Click open will add all the .jar files to the project that you can view as:
8) Click OK and you are done.
Once you click OK all the .jar files will be added and Selenium Webdriver gets installed successfully.
Now you are ready with Selenium Webdriver and you can go ahead and start writing your Selenium Webdriver Scripts under Class.
Verify Selenium Webdriver Installation:
You can verify whether Selenium Webdriver have been installed or not that you can check here-
Under Class type “webdriver driver = new FirefoxDriver() ; ” and hit space button keyboard. You will see red color line under webdriver keyword.
Now mouse over on webdriver keyword will show you the options to correct the error –
You can select the option “Change to ‘WebDriver’ (org.openqa.selenium) to correct the error.
Displaying these options confirm that you have successfully installed Selenium Webdriver in Eclipse.