I trying to run easy selenium test under Ubuntu
@Test
public void openGoogle() {
WebDriver driver = new ChromeDriver();
driver.get("https://google.com");
driver.quit();
}
but every single time I run it I am getting that error message:
com.google.common.base.Preconditions.checkState(ZLjava/lang/String;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)V
java.lang.NoSuchMethodError: com.google.common.base.Preconditions.checkState(ZLjava/lang/String;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)V
at org.openqa.selenium.remote.service.DriverService.findExecutable(DriverService.java:125)
at org.openqa.selenium.chrome.ChromeDriverService.access$000(ChromeDriverService.java:35)
at org.openqa.selenium.chrome.ChromeDriverService$Builder.findDefaultExecutable(ChromeDriverService.java:159)
...
I have tried to change my build.gradle but It does not work. Anyone meet same the problem when running Selenium tests?
Selenium can't find driver executable. You need to set path.
I have updated test like that but it still does not work. What kind of problems can couse that kind of errors?
@Test
public void openGoogle() {
System.setProperty("webdriver.chrome.driver", "/home/user/projects/chromedriver");
WebDriver driver = new ChromeDriver();
driver.get("https://google.com");
driver.quit();
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.