1

我有一组使用https://github.com/camme/webdriverjs编写的验收测试。我希望通过Selenium Server(WebDriver)和Sauce Labs对真正的浏览器运行测试。 Firefox启动正常,但Chromium(Debian Wheezy包中的30.0.1599.101)不支持。通过只设置{ desiredCapabilities: { browserName: "chrome" } }我得到ERROR COULDNT GET A SESSION ID和硒Server控制台输出显示Selenium服务器无法启动Chromium

WARN - Exception: The path to the driver executable must be set by the webdriver.chrome.driver system property; for more information, see http://code.google.com/p/selenium/wiki/ChromeDriver. The latest version can be downloaded from http://code.google.com/p/chromedriver/downloads/list 

如果我启动Selenium服务器与出现-Dwebdriver.chrome.driver=/usr/bin/chromium新的浏览器窗口,但测试不会开始运行,超时后我得到同样的ERROR COULDNT GET A SESSION ID和硒Server控制台输出显示

Created new window in existing browser session. 13:43:25.775 WARN - Exception thrown java.util.concurrent.ExecutionException: org.openqa.selenium.WebDriverException: java.lang.reflect.InvocationTargetException 
[...] 
Caused by: org.openqa.selenium.WebDriverException: java.lang.reflect.InvocationTargetException 
[...] 
Caused by: 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. 
[...] 
Caused by: org.openqa.selenium.WebDriverException: Timed out waiting for driver server to start. 
+0

显然,我需要安装Chrome的驱动程序和点'webdriver.chrome.driver'给司机,而不是浏览器的二进制文件。 –

+0

现在,通过Chrome驱动程序,我可以更进一步。 Chromium开始但是测试在开始时失败,出现'未知命令'WaitForAllTabsToStopLoading''作为响应。 –

回答

2

请以正确的方式设置ChromeDriver可执行文件路径。

System.setProperty( “webdriver.chrome.driver”, “/路径/到/ chromedriver”) //然后,你的驱动程序实例

webdriver的驱动程序=新ChromeDriver();

更多信息,ChromeDriver here

+1

在意识到我需要Chrome驱动程序后进一步了解。谢谢。 –

+0

不错,它帮助... – Manoj