Run First Test on Chrome Browser

Chrome browser implements the WebDriver protocol using an executable called ChromeDriver.exe. This executable starts a server on your system which will be responsible for running your test script in selenium.

Testcase: Open chrome browser and navigate to and close the browser


Step1: Right click on src folder and select New > Class


Step2: Provide Class Name and click on Finish


Step3: Open URL: in your browser and select any of the latest chrome driver version according to your browser version

Download executable file as per the operating system you are working on.

For windows, click on the “” download and unzip the file.


Set a system property “” to the path of your ChromeDriverServer.exe file and instantiate an ChromeDriver class.

Here below your test script will look like


import org.openqa.selenium.By;
import org.openqa.selenium.Cookie;
import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.WebDriver;

public class FirstChromeTest {

public static void main(String[] args) {

// System Property for Chrome Driver
System.setProperty("", "E:\chromedriver.exe");

// Instantiate a ChromeDriver class.
WebDriver driver=new ChromeDriver();

//Maximize the browser window driver.manage().window().maximize();

// Launch Website and navigate to URL

//close the browser



Step6: Run the code by right click on the Eclipse code and select Run As > Java Application