google-chrome - Selenium - codeception - Chrome 问题

标签 google-chrome selenium-webdriver selenium-rc

在 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 时,它工作正常。

运行selenium的命令:

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

最佳答案

要使用 Chrome 运行代码接收,请使用以下 acceptance.suite.yml:

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

请注意,我在配置中将您的浏览器从 googlechrome 更改为 chrome

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

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

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

您可以下载 chromedriver here .您还应该更新您的 selenium 独立服务器;您可以从 here 获取最新版本.

关于google-chrome - Selenium - codeception - Chrome 问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16477342/

相关文章:

xpath - 使用 br 从文本中查找 xpath

css - Google Chrome 中 flash <embed> 标签周围的白色背景

javascript - 如何将 Chrome 书签 "date_added"值解析为日期

javascript - 在selenium中执行滚动到 View 脚本时出现空指针异常

java - 通过 PID 进程杀死 Selenium 浏览器 [Java]

selenium - 如何使用 Selenium 2 发送 http RequestHeader?

java - 使用 selenium 单击 "rel"属性

regex - 如何在 Selenium 定位器中使用正则表达式

google-chrome - 从 Chrome 的预加载 HSTS 列表中删除站点

css - Mac 和 Windows 上的 chrome 滚动条行为不同