【问题标题】:Selenium server fails to launch ChromiumSelenium 服务器无法启动 Chromium
【发布时间】:2013-11-25 12:50:30
【问题描述】:

我有一组用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

如果我用-Dwebdriver.chrome.driver=/usr/bin/chromium 启动 Selenium Server,会出现新的浏览器窗口,但测试永远不会开始运行,超时后我会得到相同的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.

【问题讨论】:

  • 显然我需要安装 Chrome 驱动程序并将 webdriver.chrome.driver 指向驱动程序而不是浏览器二进制文件。
  • 现在,使用 Chrome 驱动程序,我更进一步。 Chromium 启动,但测试一开始就失败,Unknown command 'WaitForAllTabsToStopLoading' 出现在响应中。

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


【解决方案1】:

请正确设置 ChromeDriver 的可执行路径。

System.setProperty("webdriver.chrome.driver", "/path/to/chromedriver") //然后是你的Driver实例

WebDriver 驱动程序 = new ChromeDriver();

有关 ChromeDriver 的更多信息here

【讨论】:

  • 在意识到我需要 Chrome 驱动程序后更进一步。谢谢。
猜你喜欢
  • 2017-06-29
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2019-03-28
  • 1970-01-01
  • 1970-01-01
  • 2019-07-20
相关资源
最近更新 更多