所以我让 Behat 在无头浏览器上工作得很好,但是我想使用 Selenium 2 来测试一些 JavaScript 繁重的页面。
当我运行 vendor/bin/behat 时,在标有@javascript 的第一个场景中出现此错误:
Curl error thrown for http POST to http://localhost:4444/wd/hub/session with params: {"desiredCapabilities":{"browserName":"firefox","version":"8","platform":"ANY","browserVersion":"8","browser":"firefox","name":"Behat test","deviceOrientation":"portrait","deviceType":"tablet","selenium-version":"2.31.0","max-duration":300},"requiredCapabilities":[]}
couldn't connect to host
当我在配置文件中定义 443 时,我不知道为什么它连接到错误的端口。为什么它说设备类型是表格?这是我的 behat.yml:
default:
paths:
features: tests/functional/features
bootstrap: tests/functional/features/bootstrap
extensions:
Behat\MinkExtension\Extension:
base_url: http://myvirtualhost.com
goutte: ~
selenium2: ~
context:
parameters:
wd_host: 127.0.0.1:4443/wd/hub
wd_capabilities: { "browser": "firefox", "version": "21"}
我有 Selenium 2 在 127.0.0.1:4443/wd/hub 正确运行。
我安装了 Firefox 版本 21。
这是我的 composer.json,我有 Selenium 2 驱动程序:
{
"name": "my-website",
"description": "My Website",
"minimum-stability": "dev",
"require": {
"php": ">=5.3",
"zendframework/zendframework": "2.1.5",
"doctrine/common": "dev-master#d7987c96675e153638729383577090feed9854f1"
},
"require-dev": {
"phpunit/phpunit": "3.7.x-dev#19f1d742e0c36150001062f592c93f80aef3a9fd",
"behat/behat": "dev-develop#1f1bead31e96da5e30fd5d499d5cf66d29b68cf6",
"behat/mink": "v1.4.3",
"behat/mink-extension": "dev-master#ef2c8639ebc254f0ff6e555b7834700caf5db9c4",
"behat/mink-goutte-driver": "dev-master#v1.0.8",
"behat/mink-selenium2-driver": "v1.0.6"
}
}