Reputation: 11
The piece of code is:
another edit: would like to note that I'm using java to implement this so I don't think slashes would be a problem. (though correct me if i'm wrong)
edit: One more thing i'd like to add is that it actually says its starting up the chrome driver version something but immediately fails after that
System.setProperty("webdriver.chrome.driver", "webdrivers/chromedriver.exe");
driver = new ChromeDriver();
and the error i'll end up getting is
org.openqa.selenium.remote.UnreachableBrowserException: Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure.
Build info: version: '2.37.0', revision: 'a7c61cb', time: '2013-10-18 17:15:02'
System info: host: '****-PC', ip: '10.10.10.1', os.name: 'Windows 7', os.arch: 'x86', os.version: '6.1', java.version: '1.7.0_51'
There isn't a stack trace and this happens immediately after the webdriver attempts to start. I'm guessing the code above is where it happens simply because netbeans doens't really indicate where it errors out.
The mystery is that this worked on my computer but upon attempting to run it on a colleague's computer it simply produces this error. Firefox works for her but both IE and Chrome results in this. Any ideas?
edit: apparently there is a stack trace:
Driver info: driver.version: ChromeDriver
at org.openqa.selenium.remote.service.DriverService.start(DriverService.java:165)
at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:62)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:527)
... 7 more
Caused by: org.openqa.selenium.net.UrlChecker$TimeoutException: Timed out waiting for [http://localhost:8891/status] to be available after 20002 ms
at org.openqa.selenium.net.UrlChecker.waitUntilAvailable(UrlChecker.java:104)
at org.openqa.selenium.remote.service.DriverService.start(DriverService.java:163)
... 9 more
Caused by: com.google.common.util.concurrent.UncheckedTimeoutException: java.util.concurrent.TimeoutException
at com.google.common.util.concurrent.SimpleTimeLimiter.callWithTimeout(SimpleTimeLimiter.java:143)
at org.openqa.selenium.net.UrlChecker.waitUntilAvailable(UrlChecker.java:79)
... 10 more
Caused by: java.util.concurrent.TimeoutException
at java.util.concurrent.FutureTask.get(FutureTask.java:201)
at com.google.common.util.concurrent.SimpleTimeLimiter.callWithTimeout(SimpleTimeLimiter.java:130)
... 11 more
Upvotes: 1
Views: 9949
Reputation: 667
When I used the absolute path, it was giving me the error. However, when I used the directory where the executable was located, it started just fine. Here is a C# example
using OpenQA.Selenium.Chrome;
public class ChromeOptionsWithPrefs : ChromeOptions
{
public Dictionary<string, object> prefs { get; set; }
}
public static void Start()
{
var options = new ChromeOptionsWithPrefs();
options.AddArguement("-incognito");
using (IWebDriver driver = new ChromeDriver(@"C:\FilePath\", options))
{
//perform the test
driver.Navigate().GoToURL(@"http://www.google.com");
driver.Quit();
}
}
I just use the prefs to not store any data on whatever machine I am running the tests on. It is not needed, but you can pass some interesting options with it.
Upvotes: 0
Reputation: 11
You either need to add the absolute path which in Windows may need to include escaped backslashes e.g.
System.setProperty("webdriver.chrome.driver", "C:\\chromedriver\\chromedriver.exe");
driver = new ChromeDriver();
Or you can add the property to your System path.
If these options don't work it may be that there is a problem connecting to ChromeDriver. In which case you can open up the Chromedriver.exe file
WebDriver driver = new RemoteWebDriver("http://localhost:9515", DesiredCapabilities.chrome());
driver.get("http://www.google.com");
https://code.google.com/p/selenium/wiki/ChromeDriver
Upvotes: 1
Reputation: 21129
Chromedriver.exe
version 2.9C://Test//chromedriver.exe
Upvotes: 0
Reputation: 7008
webdrivers/chromedriver.exe
I suspect it could not find chromedriver. Are you sure this is the right path to chromedriver.exe
?
You should probably try with absolute path.
For example C:/Users/Name/Desktop/webdrivers/chromedriver.exe
Upvotes: 0