Ankit Patel
Ankit Patel

Reputation: 31

Could not able to launch chrome browser using the selenium webdriver

import org.openqa.selenium.chrome.ChromeDriver;

public class launch {

    public static void main(String[] args) {
        // TODO Auto-generated method stub
        ChromeDriver driver = new ChromeDriver();
        driver.get("https://www.google.com/");
    }
}

Error:

Could not find or load main class org.openqa.grid.selenium.GridLauncherV3

Upvotes: 1

Views: 251

Answers (2)

Apps Maven
Apps Maven

Reputation: 1420

In the Launch class you are directly creating the object of ChromeDriver class without giving the chrome driver path. So, before creating the ChromeDriver object you need to add:

System.setProperty("webdriver.chrome.driver","path of chromedriver.exe file");

If you have downloaded the chrome driver exe file then you need to pass that path. After this create the object of ChromeDriver class.

Upvotes: 1

undetected Selenium
undetected Selenium

Reputation: 193298

You need to set the system property webdriver.chrome.driver as follows:

System.setProperty("webdriver.chrome.driver", '/path/to/chromedriver');

Additionally, instead of using the ChromeDriver use the WebDriver interface as follows:

WebDriver driver = new ChromeDriver();

Upvotes: 0

Related Questions