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 there was an error raised while executing the line:
System.setProperty("webdriver.chrome.driver", "/ocs/browserDrivers/chromedriver.exe");
Your main issue is the incompatibility between the WebDriver binary type and the underlying Operating System.
You need download, extract and use the right format of the WebDriver binary from chromedriver.storage for your program as follows:
Linux OS:
chromedriver_linux64.tar.gz 2018-09-13 19:30:37 3.85MB
MAC OS:
chromedriver_mac64.tar.gz 2018-09-13 18:14:11 5.75MB
Windows OS:
chromedriver_win32.zip 2018-09-13 21:11:33 3.42MB
If you are using MAC OS so the System.setProperty()
line would be:
System.setProperty("webdriver.chrome.driver", "/ocs/browserDrivers/chromedriver"); //drop the extension (.exe) part
If you are using Windows OS so the System.setProperty()
line would be:
System.setProperty("webdriver.chrome.driver", "C:\path\to\chromedriver.exe"); //mention the absolute path
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…