First Step to Selenium : Selenium Installation
Selenium Installation
In this article we will install Selenium, so keep follow steps and start your first script with java.
Step 01 : Install Java on your computer
Download and install the Java Software Development Kit (JDK) ( Many users are downloading “Java Virtual Machine” so sometimes selenium scripts can be interrupted, so download Java Software Development Kit (JDK) from Download Java
Note : Check your system’s configuration before downloading Java.
After downloading java, set your JAVA path in your system and make it working.
Step 2 — Install Eclipse IDE
Download latest version of “Eclipse IDE for Java Developers” here. Be sure to choose correctly between Windows 32 Bit and 64 Bit versions.
You should be able to download an exe file named “eclipse-inst-win64” for Setup.
Double-click on file to Install the Eclipse. A new window will open. Click Eclipse IDE for Java Developers. After successful completion of the installation procedure, a window will appear. On that window click on Launch.
Step 3 — Download the Selenium Java Client Driver
You can download the Selenium Java Client Driver here. You will find client drivers for other languages there, but only choose the one for Java.
This download comes as a ZIP file named “selenium-3.14.0.zip”. For simplicity, extract the contents of this ZIP file on your C drive so that you would have the directory “C:\selenium-3.14.0\”. This directory contains all the JAR files that we would later import on Eclipse.
Step 4 — Configure Eclipse IDE with WebDriver
1. Launch the “eclipse.exe” file inside the “eclipse” folder that we extracted in step If you followed step 2 correctly, the executable should be located on C:\eclipse\eclipse.exe.
2. When asked to select for a workspace, just accept the default location.
3. Create a new project through File > New > Java Project. Name the project as “newproject”.
A new pop-up window will open enter details as follow
i) Project Name
ii)Location to save project
iii) Select an execution JRE
iv) Select layout project option
v) Click on Finish button
In this step,
i) Right-click on the newly created project and
ii) Select New > Package, and name that package as “newpackage”.
A pop-up window will open to name the package,
- Enter the name of the package
- Click on Finish button.
Create a new Java class under newpackage by right-clicking on it and then selecting- New > Class, and then name it as “MyClass”. Your Eclipse IDE should look like the image below.
When you click on Class, a pop-up window will open, enter details as
- Name of the class
- Click on Finish button.
Now selenium WebDriver’s into Java Build Path
In this step,
- Right-click on “newproject” and select Properties.
- On the Properties dialog, click on “Java Build Path”.
- Click on the Libraries tab, and then
- Click on “Add External JARs..”
When you click on “Add External JARs..” It will open a pop-up window. Select the JAR files you want to add. After selecting jar files, click on OK button.
Now you are ready with your selenium but you have to download drivers as per your browser.
Different Drivers
HTMLUnit and Firefox are two browsers that WebDriver can directly automate — meaning that no other separate component is needed to install or run while the test is being executed. For other browsers, a separate program is needed. That program is called as the Driver Server.
A driver server is different for each browser. For example, Internet Explorer has its own driver server which you cannot use on other browsers. Below is the list of driver servers and the corresponding browsers that use them.
After downloading above driver mention driver location in your selenium script.
We are looking selenium locator techniques in next blog, so keep reading, keep practicing.