1

java.lang.IllegalStateException: The path to the driver executable must be set by the webdriver.chrome.driver system property; for more information, see https://github.com/SeleniumHQ/selenium/wiki/ChromeDriver. The latest version can be downloaded from http://chromedriver.storage.googleapis.com/index.html at com.google.common.base.Preconditions.checkState(Preconditions.java:847) at org.openqa.selenium.remote.service.DriverService.findExecutable(DriverService.java:134) at org.openqa.selenium.chrome.ChromeDriverService.access$000(ChromeDriverService.java:35) at org.openqa.selenium.chrome.ChromeDriverService$Builder.findDefaultExecutable(ChromeDriverService.java:159) at org.openqa.selenium.remote.service.DriverService$Builder.build(DriverService.java:355) at org.openqa.selenium.chrome.ChromeDriverService.createDefaultService(ChromeDriverService.java:94) at org.openqa.selenium.chrome.ChromeDriver.(ChromeDriver.java:123) at iotdatanormalization.Datanormalization.beforeClass(Datanormalization.java:27) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498)

pavan
  • 11
  • 1
  • This is code---> public void beforeClass() { driver = new ChromeDriver (); System.setProperty("webdriver.chrome.driver", "C:\\Users\\TMPL-FA-1703\\Downloads\\chromedriver.exe"); } – pavan May 31 '20 at 10:11

2 Answers2

0
    enter code here
<dependency>
     <groupId>io.github.bonigarcia</groupId>
     <artifactId>webdrivermanager</artifactId>
     <version>2.2.5</version>
</dependency>
<dependency>
     <groupId>org.seleniumhq.selenium</groupId>
     <artifactId>selenium-chrome-driver</artifactId>
     <version>2.50.0</version>//Your chrome driver version
</dependency>

package example;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.testng.annotations.Test;
import io.github.bonigarcia.wdm.WebDriverManager;
public class DepChrome  {
    @Test
    public void testBrowser() {
        WebDriver driver;
        WebDriverManager.chromedriver().setup();
        driver = new ChromeDriver();        
        driver.get("https://google.com");
        String title = driver.getTitle();
        System.out.println(title);      
        driver.quit();      
    }
}
pavan
  • 11
  • 1
0

Pls check your chrome driver path ,error is saying there is no chrome driver at your path

 @Test
public void testLogin() throws InterruptedException {
    System.setProperty("webdriver.chrome.driver","chromepath);
    WebDriver driver = new ChromeDriver();
    driver.manage().window().maximize();
    driver.get(url);
Justin Lambert
  • 940
  • 1
  • 7
  • 13