Java Installation & Environment Setup for Selenium WebDriver

In order to write down Selenium test scripts, you ought to set up the Java Development Kit (JDK) now referred to as formally named Java Platform Standard Edition or Java SE.

Please follow the following steps for doing Java installation for Selenium Webdriver.

Download the JDK installer program from Oracle official page:

https://www.oracle.com/java/technologies/javase-downloads.html

You will see the following page.

Java Download link Selenium

Click on the JDK Download link. It will navigate you to the JDK download page. The current version of JDK is 14. You would possibly see a newer version if it has been rolled out.

JDK Download Page

Click on the Windows version of the JDK download link. It will ask you to accept the License Agreement. First, click on the Check and then click on the download link.

JDK Agreement

The download will be started. If you are using a chrome browser you can see it at the left bottom of the browser window.

JDK-zip-file

Steps to Install JDK

After completing the download, go inside the download folder and look for the downloaded JDK compressed file and extract it to any directory. I have extracted it under C:\.

JDK

Now you will have to set up the Environment variables.

Steps to set the Java Environment variables

Step 1: Right, Click on the My Computer or This PC in Windows 10 and select the Properties.

MyCompProperties

Step 2: On the next screen click on the Advanced System Settings.

System Properties

Step 3:The System Properties window will open. Switch to the Advanced tab if it is not selected and click the Environment Variables button.

System Properties

Step 4: Now Click on the “New” button under System variables.

System-Variable

Step 5: Type JAVA_HOME (in CAPS) in the Variable name field and provide the path of the JDK directory in the Variable value field.

Edit-System-Variable

Step 6: Click on the OK button. You will see that the JAVA_HOME variable has been added to the list of System Variables.

JAVA_HOME

Step 7: Next you will have to edit the Path variable if it already exists or you will have to create a new Path variable in the same fashion as we have added the JAVA_HOME variable. Most likely the Path variable will be there. Select it and click on the Edit button.

Path-Variable1

Step 8: Now click on the Variable value field and press the End key to move the cursor to the extreme right-hand and type a semicolon and after that paste the path up to the bin directory of Java.

Path-Variable-2

*Note: Semicolon(;) is the delimiter to separate multiple path variable values.

Step 9: Click the OK button. The path variable would be updated. Again click on the OK button the apply the changes in Environment variables.

Verify Java Installation

In order to verify that Java has been installed successfully and environment variables have been set correctly open the command prompt and type java -version. The command should run successfully and it would display the version of Java that we have installed.

Java-version

So now we are done with the Java installation. The next step would be Eclipse installation which is the most preferred IDE to write Java programs. Please refer to the next article How to Download and Install Eclipse.

Recommended Posts

Leave a Reply