Mat*_*x12 5 javascript php validation behat
我有使用JavaScript的验证表单,我想测试验证消息,因为消息是几种语言.然而,Behat引发了一个例外
无法打开连接:http POST引发的卷曲错误
http:// localhost:4444/wd/hub/session with params:{"desiredCapabilities":{"tags":["vagrant-ubuntu-trusty-32","PHP 7.0.1-2 + deb.sury.org ~relusty + 1"],"浏览器":"firefox","ignoreZoomSetting":false,"name":"Behat feature suite","browserName":"firefox"}}
无法连接到localhost端口4444:连接被拒绝(Behat\Mink\Exception\DriverException)
Feature: Validator form contact
In the contact form to see a validator message
@javascript
Scenario: Message validation in English lang
Given I am on "/"
When I fill in "name" with "behat"
And I fill in "email" with "example@example.com"
And I fill in "phone" with "111222333"
And I fill in "message" with "That test message, send via Behat."
When I press "Send Message"
Then I wait for the suggestion box to appear
Then I should see "Your message has been sent."
Run Code Online (Sandbox Code Playgroud)
class FeatureContext extends MinkContext {
public function __construct() {
}
/**
* @Then /^I wait for the suggestion box to appear$/
*/
public function iWaitForTheSuggestionBoxToAppear() {
$this->getSession->wait(5000, false);
}
Run Code Online (Sandbox Code Playgroud)
behat.yml:
default:
extensions:
Behat\MinkExtension:
goutte: ~
base_url: 'http://localhost.dev/'
javascript_session: selenium2
browser_name: firefox
selenium2: ~
Run Code Online (Sandbox Code Playgroud)
我该如何测试这个案子?
只是一个简单的问题,您是否在端口 4444 上启动了 WebDriver?
因为我通过关闭 chromedriver 复制了您遇到的错误。
[Behat\Mink\Exception\DriverException]
Exception has been thrown in "beforeScenario" hook, defined in FeatureContext::windowSizeChange()
Could not open connection: Curl error thrown for http POST to http://127.0.0.1:9515/session with params: {"desiredCapabilities":{"browserName":"chrome","version":"8","platform":"ANY","browserVersion":"8","browser":"firefox","name":"Behat test","deviceOrientation":"portrait","deviceType":"tablet","selenium-version":"2.31.0","max-duration":300}}
Failed to connect to 127.0.0.1 port 9515: Connection refused
[WebDriver\Exception\CurlExec]
Curl error thrown for http POST to http://127.0.0.1:9515/session with params: {"desiredCapabilities":{"browserName":"chrome","version":"8","platform":"ANY","browserVersion":"8","browser":"firefox","name":"Behat test","deviceOrientation":"portrait","deviceType":"tablet","selenium-version":"2.31.0","max-duration":300}}
Failed to connect to 127.0.0.1 port 9515: Connection refused
Run Code Online (Sandbox Code Playgroud)
对于硒网络驱动程序:java -jar selenium-server-standalone-<versionNumber>.jar -port 4444
对于 Chrome 驱动程序:chromedriver --port=4444
对于歌剧驱动程序:operadriver --port=4444
另外,这个片段在您的FeatureContext.php 中吗?
default:
extensions:
Behat\MinkExtension:
goutte: ~
base_url: 'http://localhost.dev/'
javascript_session: selenium2
browser_name: firefox
selenium2: ~
Run Code Online (Sandbox Code Playgroud)
因为如果是,则它位于错误的位置,并且需要位于您的 behat.yml 文件中。
| 归档时间: |
|
| 查看次数: |
1201 次 |
| 最近记录: |