After successfully set up the Eclipse IDE, let’s start with creating the class for the automation and implement the Automation Suite to move ahead with our automation tests.
Setting up Eclipse Environment
- To open the Eclipse IDE, double click on eclipse file.
- Once Eclipse open, browse your workspace to save your program.
- Click on Launch button, to launch your Eclipse IDE, once it’s open you’ll see the Welcome screen in the Eclipse window. Click on Workbench will redirect you to the Eclipse workbench.
- Now we’re going to create our first Java project. For that go to File > New > Project. You’ll see a window with the list of project types.
- From the Project wizard, select the Java Project, and click on Next button.
- Now enter your valid project name and click on the Finish button to create your Java Project.
- Once the project will be created we will require the package for our project, for that right-click on the Project > New > Package.
- Enter a valid package name and click on Finish button, package name must be of small letters and should not contain special characters.
- Once the package is created, we’re now ready to create the Java class to write our Java code of Selenium Automation. Again, right-click on the Project > New > Class.
- Enter the Java class name (Starting with Capital letter and follow with CamelCase).
- Check the public static void main(String args) checkbox. (It is the main method for Java execution)
- Click on Finish button.
- Finally, you just created your first Java class, you can see the Java class name and main method in the code template.
Setting up Selenium with Eclipse
- To set up our crate Eclipse Java project, we need to download the Selenium jar. You can download jar from this URL.
- Go to the URL and you can download the latest Selenium jar from there.
- Once the Jar download is completed, go again to our project, right-click on the Project > Build Path > Configure Build Path.
- Go to Libraries tab and click on Add External JARs… button.
- Select the downloaded Selenium Jar and add it.
- Click on Apply and Close once you can see your Selenium JAR in Libraries.
- Finally, we have completed the set up for the Selenium as well with our project. You can see the Selenium Jar in the reference library.