2

I am using selenium chrome driver with version 3.6.0 and using google-guava 23.0. When i do this :

 ChromeOptions chromeOptions = new ChromeOptions();

It gives following error :

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:124)
    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:329)
    at org.openqa.selenium.chrome.ChromeDriverService.createDefaultService(ChromeDriverService.java:88)
    at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:157)

I also checked this : https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-chrome-driver/3.6.0 Can anyone help me what version of guava should i use here ?

Code :

System.setProperty("webdriver.chrome.driver", driverPath);
    log.warn("chrome driver path is : {}", driverPath);
    List<String> options = proxyConfig.getChromeOptions();
    ChromeOptions chromeOptions = new ChromeOptions();
      chromeOptions.addArguments(options);
    Map<String, String> capabilites = proxyConfig.getCapabilities();
    for(Map.Entry<String, String> entry : capabilites.entrySet()) {
      chromeOptions.setCapability(entry.getKey(), entry.getValue());
    }
    return new ChromeDriver(chromeOptions);
Bhagwati Malav
  • 3,349
  • 2
  • 20
  • 33

1 Answers1

0

It is not clear from your question about your particular usecase why you are trying to signal out Selenium Client v 3.6.0 and google-guava 23.0 individually.

To keep it simple,

  • Selenium Client v 3.6.0 uses guava v23.0
  • Release Notes of Selenium Client v 3.5.1 clearly mentions the following :
  • Bump guava to version 23.

So, I don't see any issue out there.

However, as an end user instead of selecting individual jars from multiple selenium-java-X.Y.Z.zip releases user should consider completely removing all the Selenium related jars from the older build and replace with the new jars from the new build.

This particular issue

This error message...

java.lang.NoSuchMethodError: com.google.common.base.Preconditions.checkState(ZLjava/lang/String;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)V

...implies that the Java Client was unable to find ChromeDriver()

It will be tough to analyze the real issue in absence of your code trials. However as per java.lang.NoSuchMethodError: com.google.common.base.Preconditions.checkState(ZLjava/lang/String;) with Selenium, gradle and ChromeDriver you need to use the System.setProperty() line to set the ChromeDriver binary path (not the chrome binary path). For that you have to download the ChromeDriver binary from the ChromeDriver - WebDriver for Chrome and place it in your system and mention the absolute path of the ChromeDriver through System.setProperty() line. Hence you have to use the line :

System.setProperty("webdriver.chrome.driver", "C:\\path\\to\\chromedriver.exe");
ChromeOptions chromeOptions = new ChromeOptions();
// configurations through chromeOptions 
WebDriver driver = new ChromeDriver(chromeOptions );
undetected Selenium
  • 183,867
  • 41
  • 278
  • 352