Installation Guide:
Java + Eclipse +
Selenium
Pacematic corporate training center
Batch: July morning 2022
Author: Mayur Narnaware
([Link]@[Link])
Downloading Java JDK
We are going to download Java 17 as it is more stable than the latest Java 18 version.
Click on Link: [Link]
If you are not able to find Java 17, then scroll down a little bit and click on Java 17 as shown in
below screenshot and you will find the JDK by heading: “Java SE Development Kit 17.0.4
downloads”. Refer below screenshot for details:
Click on windows option as shown in above screenshot to find the JDK Windows installer.
When you click on windows, you will see three installation option in above screenshot. Click on
the link for “x64 Installer” highlighted in red and the Java installer will start downloading.
Check below screenshot:
Installing JDK
After downloading the JDK file, double click on it to start the installation process. In below
pop-up, click Yes.
You will then see below pop-up, click on next.
Do not change anything on the below next pop-up and click on next.
This will finally start the Java installation:
Once the installation is completed, click on close to finish the Java installation:
Verify Java installation:
After the installation, open Command prompt window, type java -version and press Enter.
If you see the above error in Command prompt, it means that your system doesn’t know where
your java is located.
For resolving this error, you need to set the Java path in your environment variable in
“Set Java path in Environment Variables ” section on next page.
Note: If you don’t see any error and see the java version as per below
screenshot then go directly to Eclipse installation section, install eclipse.
Set Java path in Environment Variables:
1. Go to the Windows Search box and type ‘Advanced system settings’ in it. Now click on the
View advanced system settings.
2. Select the Advanced tab and then click environment variables.
3. See below screenshot, in the system, variables click the New button. Now in the ‘New system
variable’, type variable name as JAVA_HOME and variable path as the path where the JDK
folder is installed and click on OK button.
Usually the path of the JDK file will be: C:\Program Files\Java\jdk-17.0.1
4. Now in the system variables select the path variable and click the edit button.
5. Click the New button.
6. Now add the following path: %JAVA_HOME%\bin
After this, close the existing command prompt window, open Command prompt window
again, type java -version, and press Enter. If you have carefully followed all the above steps
you should see below message. This means your Java path is set successfully and you can
start installing the eclipse.
Downloading Eclipse:
We need Eclipse IDE to write Java Program. For our practice, we will be downloading any
older Eclipse version i.e., Eclipse IDE 2021-09. We will not download the latest version to
avoid any compatibility issue in future.
Click on below link:
[Link]
Once the website is launched, you can see all the previous versions of Eclipse. Select any version
of Eclipse of your choice. As already mentioned, we will download Eclipse IDE 2021-09. Click on
it as per below screenshot.
On the next page, you will see different packages of Eclipse IDE 2021-09. For any version of
Eclipse, always select R Packages.
On next page, you will find different types of Release packages for different types of developers.
We are going to use Java for basic programming and Automation. So we have to select Eclipse
IDE for Java Developers
In above screenshot you will see options to download Eclipse for different operating system like
Windows, macOS and Linux. Since we are installing in Windows, select Windows x86_64. This
version of eclipse only supports 64-bit Windows OS. For 32-bit Windows OS, refer old
document.
Once you click on Windows x86_64, a zip file will get downloaded like below screenshot.
After the completion of download, go to your downloads folder where your eclipse zip file is
downloaded. Screenshot below:
The file will be in the form of zip. So, we need to extract this Zip file to use it. Extract the zip file to a
location of your choice.
To extract, right click on the zip file and select ‘Extract all’/’Extract files’ option.
Select your extraction folder or enter the folder path in the Destination path and click Ok. Your
files will start getting extracted in that folder. Check below screenshot.
Your selected folder will be displayed in the path, Now click on Extract.
After complete extraction. Go to the path given by you in above screenshot ( do not refer to my
path, it will be different for you. So, check the path given by you), you will see all your extracted
files.
In the same folder, you will see a blue icon named [Link].
Double click on it and your Eclipse application will get launched.
You will see below window to select a directory as a Workspace.
Workspace is a folder where all your projects and files will be stored.
If you want to create your workspace on a different location, you can change the default path, or
else keep it unchanged and click on Launch to launch the Eclipse IDE.
If you see below screen, it means that the eclipse is successfully installed and working.
Close the welcome screen. Now here you can create a new project and start writing your code in
Java.
To create new Java Project: Go to file New Java Project
On the next window, give the name of the project, unselect the Module checkbox and click on
Finish.
You will see you project created under package explorer in below screenshot:
Now you need to add a package, for that right click on “src” folder in the screenshot above: Go to
new click Package
In the next window give the name of you package and press Finish.
Then you need to create a class to write your program, for that right click on the newly created
package in the above step: Go to new select Class
Give the name of you class Click on the “public static void main” checkbox click finish.
You can see the newly created class file “[Link]” in below screenshot, now you can
write you programming steps inside “public static main” method.
Downloading Selenium WebDriver
You can download Selenium Webdriver for Java Client Driver here. Click on Latest stable
version 4.3.0 below. Your file will start getting downloaded.
Check your downloads folder for the downloaded file:
Now go to Eclipse and create a project. Right click on the project select Properties
In the properties window, go to Java Build Path Libraries Select Classpath Click on Add
External Jars
Note: Add all external jars always in the Classpath otherwise your jars will not work.
In the next Jar selection window, navigate to downloads folder where your selenium jar was
downloaded and select it and click open.
Once you click on Open, your selenium jar will be added to your project libraries shown below.
Click on Apply Ok.
You will also see the Selenium libraries in the referenced Libraries under your project in eclipse.
Note: You will have to compulsorily perform all the above steps to add selenium jar for each new
java project that you create in Eclipse.
Different Drivers
A separate program is needed to automate the different types of browser. 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.
Browser Name of Driver Server Link to download
Chrome ChromeDriver [Link]
Firefox Mozilla GeckoDriver [Link]
Internet Explorer Driver [Link]
Internet Explorer
Server
[Link]
Edge MS Edge Driver
edge/tools/webdriver/
[Link] Driver:
Go to the link for ChromeDriver in the above table. Now Open you chrome browser and check the
version of chrome : Click on 3 Dots Help About Google Chrome
Once you click on About Google Chrome, in the next window Chrome will start updating to the
latest version. After updating to the latest version, it will ask you to restart chrome browser.
Now When you visit the link to dowload the Chrome driver, you have to make sure , that the
chrome browser version is same as the ChromeDriver version:
ChromeDriver version:
Chrome browser version:
Now click on the expected version of Chromedriver that matches with the Chrome browser version.
You will see below screen and Click on Chromedriver_win32.zip file. It will start getting
downloaded.
Since downlaoded file will be in zip format, Extract the zip file and you will get the [Link]
file.
Note: If you are not able to see the extension of any file, then Open any File explorer
windowclick on View at the top select the checkbox for ‘File name extensions’ option:
[Link] Gecko Driver:
Go to the link for GeckoDriver in the above table. On the webpage loaded, scroll down a little bit
and you will be able to assets section:
In the above screenshot, you have two options win32 and win64. If your operating system is of 32
bit then download win32 version and if your system is 64 bit then download win64 version. Just
click on it and your zip file will get downloaded.
Always remember to extract the zip file to get the actual file.
Right click on the zip file extract
After this, you will be able to see [Link] file in the extracted folder.
Note: To extract any zip file,when you right click, you will bydefault get an option extract all
If you don’t get this option then you will have to install Winrar software.
[Link] driver server:
Go to the link for Internet explorer driver server in the above table. On the webpage loaded, scroll
down a little bit and you will be able to see the driver:
In the above screenshot, you have two options 32 bit Windows IE and 64 bit Windows IE. If your
operating system is of 32 bit then download 32 bit version and if your system is 64 bit then
download 64 bit version. Just click on it and your zip file will get downloaded.
Always remember to extract the zip file to get the actual file.
Right click on the zip file extract
After this, you will be able to see [Link] file in the extracted folder.
4. MS Edge Driver:
Go to the link for MS Edge Driver in the above table. On the webpage loaded, scroll down a little bit
and you will be able to see the driver: Always download the stable version
Click x86 for 32 bit system and click x64 for 64 bit operating system and zip file will be downloaded.
Follow the same process to unzip the file and then you will get [Link] file.
Note: Always remember to update your browser to the latest version.