Webdriver Configuration For Java
Webdriver Configuration For Java
Please use the following steps one by one to configure Eclipse with Web Driver.
1. Install JDK
a. Double click on jdk exe file and follow wizard.
b. Go to Environment Variables screen
Add User Variable with the variable value where you install the jdk.
Variable Name: JAVA_HOME
Variable Value: C:\Program Files\Java\jdk1.8.0_131
Go to System Variables section and select Path variable. In path variable past the path of
your installed jdk till bin foler. For Example
“C:\Program Files\Java\jdk1.8.0_131\bin”
c. To check that JDK successfully installed. Open command prompt and type “javac” and
hit enter.
2. Download and double click on Eclipse to open it.
a. Create a new java project using following steps
File > New > Java Project
b. Add Package in src folder
New > Package
c. Add Package name with following convention
com.selenium.configuration.test
3. Add Testng Adson in Eclipse using following steps.
a. Go to Help > Eclipse Marketplace
b. Find TestNG for Eclipse and install it.
c. After installation restart the Eclipse
4. Add Selenium Jar files in the Project using following steps.
a. Download Selenium, TestNG and JCommander jar files.
b. Extract them into a folder.
c. Add them into main project
Left Click on project > Build Path > Configuration Build Path > Java Build Paht > Libraries
> Add External JARs > Select All Jar files > Click Ok
package com.selenium.configuration.test;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.testng.annotations.Test;
@Test
public void ChromeProgram()
{
System.setProperty("webdriver.chrome.driver",
"F:\\Automation\\chromedriver.exe");