2

在 selenium 服务器中使用 codeception 在 chrome 上运行测试时随机出现以下错误:

WebDriver\Exception\UnknownError: The current platform is not supported: LINUX

WebDriver\Exception\UnknownError: Unable to find executable for product Opera Desktop

WebDriver\Exception\UnknownError: The path to the driver executable must be set by the phantomjs.binary.path capability/system property/PATH variable; for more information, see https://github.com/ariya/phantomjs/wiki. The latest version can be downloaded from http:\//phantomjs.org/download.html

当给定Firefox时,它可以正常工作。

运行硒的命令:

java -jar selenium-server-standalone-2.31.0.jar -browser googlechrome

以下是acceptance.yml内容

class_name: WebGuy
modules:
  enabled:
    - Selenium2
    - WebHelper
  config:
    Selenium2:
      url: 'http://www.google.com'
      browser: googlechrome
  delay: 350
4

1 回答 1

9

要使用 Chrome 运行 codeception,请使用以下命令acceptance.suite.yml

class_name: WebGuy
modules:
  enabled:
    - Selenium2
    - WebHelper
  config:
    Selenium2:
      url: 'http://www.google.com'
      browser: chrome
      delay: 350

请注意,我将配置中的浏览器从 更改googlechromechrome.

此外,使用以下命令启动 Selenium2:

java -Dwebdriver.chrome.driver=./chromedriver -jar selenium-server-standalone-2.31.0.jar

请注意,启动 selenium 时不需要指定浏览器。

您可以在此处下载 chromedriver 。您还应该更新您的 selenium 独立服务器;您可以从这里获取最新版本。

于 2013-08-13T09:01:10.093 回答