BhavinD.
BhavinD.

Reputation: 481

Selenium WebDriver - Maven - IllegalState The path

I have created a Maven Project for Selenium WebDriver with TestNG. All the dependencies and required plugins are added in POM.xml file.

When I run maven project Maven-test. I'm getting result as below:

> Failed tests:    LoginAndVerify.LoginWithInvalidUsernameAndPassword:15 IllegalState The path to the driver exec...

My Test Cases scripts:

import org.testng.annotations.Test;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;


public class LoginAndVerify {

    public WebDriver driver;

    @Test
    public void LoginWithInvalidUsernameAndPassword() {
        driver = new ChromeDriver();
        driver.get("https://www.google.co.in/");
        driver.manage().window().maximize();
        System.out.println("URL opened!");
        driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
    }
}

Upvotes: 0

Views: 152

Answers (1)

learner
learner

Reputation: 505

You need to download the chrome driver exe from: ChromeDriver download

Then you need to mention it as below

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

Upvotes: 1

Related Questions