Selenium – How to run Selenium WebDriver test cases in Chrome


I tried this

WebDriver driver = new ChromeDriver();

But I'm getting the error as

Failed tests: setUp(com.TEST): The path to the driver executable must be set by the system property; for more information, see code here . The latest version can be downloaded from this link

How can I make Chrome test the Selenium WebDriver test cases?

Best Solution

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("", "/path/to/chromedriver");
WebDriver driver = new ChromeDriver();

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