N
N
Nikolay Baranenko2017-04-22 23:24:16
Java
Nikolay Baranenko, 2017-04-22 23:24:16

Why does the error com.google.common.base.Preconditions.checkState(ZLjava/lang/String;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;) occur?

Hello.
Today I decided to try selenium on java for the first time.
Google Chrome browser 57.0.2987.133 (64-bit),
webdriver chrome ChromeDriver 2.29.461591 (62ebf098771772160f391d75e589dc567915b233),
Java
version java version "1.8.0_131"
Java(TM) SE Runtime Environment (build 1.8.0_131
Java HotSpot(TM ) ) 64-Bit Server VM (build 25.131-b11, mixed mode).
89fd46008d9144f891b6fd2dc8f015dc.png
tried to execute the simplest code

System.setProperty("webdriver.chrome.driver", "C:\\Server\\templates\\selenium\\chromedriver.exe");
        DesiredCapabilities capabilities = DesiredCapabilities.chrome();
        ChromeOptions options = new ChromeOptions();
//this statement will not show any warnings when you launch chrome
        options.addArguments("test-type");
//start a maximized window
        options.addArguments("start-maximized");
//this allows you to use a user profile
        capabilities.setCapability("chrome.binary", "C:\\Server\\templates\\selenium\\chromedriver.exe");
        capabilities.setCapability(ChromeOptions.CAPABILITY, options);
        WebDriver driver = new ChromeDriver(capabilities);

and got an error
Exception in thread "main" 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:111)
  at org.openqa.selenium.chrome.ChromeDriverService.access$000(ChromeDriverService.java:32)
  at org.openqa.selenium.chrome.ChromeDriverService$Builder.findDefaultExecutable(ChromeDriverService.java:137)
  at org.openqa.selenium.remote.service.DriverService$Builder.build(DriverService.java:302)
  at org.openqa.selenium.chrome.ChromeDriverService.createDefaultService(ChromeDriverService.java:88)
  at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:146)

How to solve this problem?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
Nikolay Baranenko, 2017-04-22
@drno-reg

the problem was that I was using the old guava package... I
replaced it with guava-21.0.jar and this error went away.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question