I'm trying to simply start the chrome driver but getting some timeout errors. the browser does start but then closed after few sec with the following exception:
System info:
Build info: version: '3.14.0', revision: 'aacccce0', time: '2018-08-02T20:19:58.91Z'
System info: host: 'MAC-images-MacBook-Pro-1164.local', ip: '----', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.13.6', java.version: '1.8.0_172'
Driver info: driver.version: ChromeDriver] with root cause
at java.util.concurrent.FutureTask.get(FutureTask.java:205)
~[na:1.8.0_172] at
com.google.common.util.concurrent.SimpleTimeLimiter.callWithTimeout(SimpleTimeLimiter.java:156)
~[guava-25.0-jre.jar:na] at
org.openqa.selenium.net.UrlChecker.waitUntilAvailable(UrlChecker.java:75)
~[selenium-remote-driver-3.14.0.jar:na] at
org.openqa.selenium.remote.service.DriverService.waitUntilAvailable(DriverService.java:188)
~[selenium-remote-driver-3.14.0.jar:na] at
org.openqa.selenium.remote.service.DriverService.start(DriverService.java:179)
~[selenium-remote-driver-3.14.0.jar:na] at
org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:79)
~[selenium-remote-driver-3.14.0.jar:na] at
org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:548)
~[selenium-remote-driver-3.14.0.jar:na] at
org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:212)
~[selenium-remote-driver-3.14.0.jar:na] at
org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:130)
~[selenium-remote-driver-3.14.0.jar:na] at
org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:181)
~[selenium-chrome-driver-3.14.0.jar:na] at
org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:168)
~[selenium-chrome-driver-3.14.0.jar:na] at
org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:123)
~[selenium-chrome-driver-3.14.0.jar:na] at
com.example.tests.bl.impl.AutomationRunner.run(AutomationRunner.java:29)
~[classes/:na]
Code snip:
@Component
public class AutomationRunner implements IAutomationRunner {
@Override
public void run() throws MalformedURLException {
System.setProperty("webdriver.chrome.driver",
"/Applications/Google Chrome.app/Contents/MacOS/Google Chrome");
ChromeDriver driver = new ChromeDriver();
driver.get("www.google.com");
driver.close();
driver.quit();
}
}
Packages been used:
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>3.141.59</version>
</dependency>
Any idea on what do I miss here? Thanks
This error message...
Build info: version: '3.14.0', revision: 'aacccce0', time: '2018-08-02T20:19:58.91Z'
System info: host: 'MAC-images-MacBook-Pro-1164.local', ip: '----', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.13.6', java.version: '1.8.0_172'
Driver info: driver.version: ChromeDriver
.
com.google.common.util.concurrent.SimpleTimeLimiter.callWithTimeout(SimpleTimeLimiter.java:156)
~[guava-25.0-jre.jar:na] at
org.openqa.selenium.net.UrlChecker.waitUntilAvailable(UrlChecker.java:75)
...implies that the ChromeDriver was unable to initiate/spawn a new WebBrowser ie Chrome Browser session.
Your main issue is within the System.setProperty()
line where you have passed the absolute path of the Google Chrome binary instead of ChromeDriver binary.
You need to download the relevant ChromeDriver binary for Mac OS X ie chromedriver_mac64 and place it anywhere within your system, extract the ChromeDriver binary and pass the absolute path within the System.setProperty()
as follows:
System.setProperty("webdriver.chrome.driver", "/path/to/chromedriver");
I faced the same problem. There is another solution for this.
Selenium requires Guava. Add below dependency as maven dependency to pom.xml.
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>25.0-jre</version>
</dependency>
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.