Selenium服务器无法启动Chromium

时间:2013-11-25 12:50:31

标签: selenium-webdriver chromium selenium-chromedriver selenium-server webdriver-io

我有一组用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和Selenium Server控制台输出显示

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 Server并显示-Dwebdriver.chrome.driver=/usr/bin/chromium新浏览器窗口,但测试永远不会开始运行,超时后我得到相同的ERROR COULDNT GET A SESSION ID和Selenium 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.

1 个答案:

答案 0 :(得分:2)

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

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

WebDriver driver = new ChromeDriver();

有关ChromeDriver的更多信息here