在 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/