How to run Selenium WebDriver test cases in Chrome

Download the updated version of the Google Chrome driver from Chrome Driver.

Please read the release note as well here.

If the Chrome browser is updated, then you need to download the new Chrome driver from the above link, because it would be compatible with the new browser version.

public class chrome
{

    public static void main(String[] args) {

        System.setProperty("webdriver.chrome.driver", "/path/to/chromedriver");
        WebDriver driver = new ChromeDriver();

        driver.get("http://www.google.com");
    }

}

You should download the chromeDriver in a folder, and add this folder in your PATH environment variable.

You'll have to restart your console to make it work.


You need to download the executable driver from: ChromeDriver Download

Then use the following before creating the driver object (already shown in the correct order):

System.setProperty("webdriver.chrome.driver", "/path/to/chromedriver");
WebDriver driver = new ChromeDriver();

This was extracted from the most useful guide from the ChromeDriver Documentation.