Behat Test Verification Message

I have a validation form using JavaScript, and I want to validate the validation message because the messages are in multiple languages. However, Behat throws an exception

Could not open connection: Curl error for http POST for

http: // localhost: 4444 / wd / hub / session with parameters: {"desiredCapabilities": {"label": ["tramp-ubunt-tested-32", "PHP 7.0.1-2 + deb.sury.org ~ tested + 1 "]," browser ":" firefly "" ignoreZoomSetting ": false," name ":" Behat function set "," browserName ":" firefox "}}

Failed to connect to local port 4444: connection refused (Behat \ Mink \ Exception \ DriverException)

Function: validator form contact In the contact form to see the 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." 

the FeatureContext class extends MinkContext {

 public function __construct() { } /** * @Then /^I wait for the suggestion box to appear$/ */ public function iWaitForTheSuggestionBoxToAppear() { $this->getSession->wait(5000, false); } default: extensions: Behat\MinkExtension: goutte: ~ base_url: 'http://localhost.dev/' javascript_session: selenium2 browser_name: firefox selenium2: ~ 

How can I check this case?

+5
source share
3 answers

Just a quick question: did you start your WebDriver on port 4444?

Because I replicated the error you received by simply disabling my chrome reverse.

  [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 

For selenium webdriver: java -jar selenium-server-standalone-<versionNumber>.jar -port 4444

For chrome rib: chromedriver --port=4444

For the operand: operadriver --port=4444

And also this segment in your FeatureContext.php?

default: extensions: Behat\MinkExtension: goutte: ~ base_url: 'http://localhost.dev/' javascript_session: selenium2 browser_name: firefox selenium2: ~

Because, if so, it is in the wrong place and should be in your behat.yml file.

+1
source

You can use the default chrome driver for the last selenium, and it will only support the Chrome browser.

put in behat.yml

 default: autoload: '': %paths.base%/features/bootstrap extensions: Behat\MinkExtension: base_url: your url default_session: selenium2 files_path: features/Resources show_cmd: 'open %s' selenium2: browser: chrome wd_host: http://localhost:4444/wd/hub 

Using the latest version of selenium should be 52.3

0
source

I tried many options to fix this problem, but for me it was a version with chrome ribs. Finally, I managed to fix it by downloading the correct version of the chrome rib from http://www.seleniumhq.org/download/ , because the one I had was out of order.

0
source

Source: https://habr.com/ru/post/1241315/


All Articles