0

I am working on a Behat setup with Selenium and Chromedriver for running Behat tests for a Drupal 7 setup.

I am getting:

exception ‘WebDriver\Exception\UnknownError’ with message 'Timed out waiting for driver server to start.

Above this error, i am also seeing:

21:46:42.198 INFO [ActiveSessionFactory.apply] - Capabilities are: Capabilities {browser: firefox, browserName: chrome, ignoreZoomSetting: false, name: Behat feature suite, tags: [railsonfire_5e8a4d2e-8ba4-4…, PHP 5.6.34]} 21:46:42.199 INFO [ActiveSessionFactory.lambda$apply$11] - Matched factory org.openqa.selenium.remote.server.ServicedSession$Factory (provider: org.openqa.selenium.chrome.ChromeDriverService) /home/rof/src/bitbucket.org/myorganisation/myproject/chromedriver: 1: /home/rof/src/bitbucket.org/myorganisation/myproject/chromedriver: Syntax error: “(” unexpected 21:47:02.201 ERROR [OsProcess.checkForError] - org.apache.commons.exec.ExecuteException: Process exited with an error: 2 (Exit value: 2)

I am running:

java -Dwebdriver.chrome.driver=./chromedriver -jar selenium-server-standalone-3.10.0.jar 2>&1 &

to start selenium with chromedriver in my pipeline.

I am downloading and unzipping chromedriver like so:

–2018-03-19 20:39:43-- http://chromedriver.storage.googleapis.com/2.35/chromedriver_mac64.zip Resolving chromedriver.storage.googleapis.com (chromedriver.storage.googleapis.com)… 172.217.7.176, 2607:f8b0:4004:80c::2010 Connecting to chromedriver.storage.googleapis.com (chromedriver.storage.googleapis.com)|172.217.7.176|:80… connected. HTTP request sent, awaiting response… 200 OK Length: 5508030 (5.3M) [application/zip] Saving to: chromedriver_mac64.zip

100%[======================================>] 5,508,030 --.-K/s in 0.04s

2018-03-19 20:39:44 (120 MB/s) - chromedriver_mac64.zip saved [5508030/5508030]

Archive: chromedriver_mac64.zip inflating: /home/rof/src/bitbucket.org/myorganisation/myproject/chromedriver

My behat.yml file used for CI

default:
  suites:
    default:
      contexts:
        - FeatureContext
        - Drupal\DrupalExtension\Context\DrupalContext
        - Drupal\DrupalExtension\Context\MinkContext
        - Drupal\DrupalExtension\Context\MessageContext
        - Drupal\DrupalExtension\Context\DrushContext
     filters:
      tags: "~@wip"
  extensions:
    Behat\MinkExtension:
      goutte: ~
      javascript_session: 'selenium2'
      browser_name: 'chrome'
      selenium2:
      wd_host: 'http://127.0.0.1:4444/wd/hub'
    # Should be removed once 
    https://github.com/Behat/MinkExtension/pull/311 gets into a release.
      capabilities:
        marionette: null
    # Remove STOP
    base_url: 'http://127.0.0.1:8080'
  Drupal\DrupalExtension:
    blackbox: ~
    api_driver: 'drupal'
    drupal:
      drupal_root: '${project.basedir}'
    text:
      username_field: 'Gebruikersnaam'
      password_field: 'Wachtwoord'
      log_in: 'Log in'
      log_out: 'Uitloggen'

Please ignore the ${project.basedir}, this gets replaced with the phing build target.

Ps: Also note that locally all behat tests run perfectly fine.

All suggestions welcome!

  • Could you please share your behat.yml file. Please recheck that you have correctly configured everything required. – Aswini K Mar 20 '18 at 7:09
  • Added it to the question – Guardian Mar 20 '18 at 10:19
  • Ok. Have you started phantomjs before executing the behat. And I think we need to change the port of wd_host. Can you please try with below steps: 1. Change the port as 8643 instead of 4444 for wd_host 2. Open one PuTTY session and execute phantomjs by using the command phantomjs --ignore-ssl-errors=true 3. Take new PuTTY seesion and Execute behat – Aswini K Mar 20 '18 at 12:11
  • Im not using phantomjs. Im using chromedriver to test JS behaviour. Isnt this usable on a CI?! – Guardian Mar 20 '18 at 13:51
  • Ok. I have used phantomJS, chromedriver also suitable (port 9515 by default). Can you please look in to stackoverflow.com/questions/43537347/…. Also – Aswini K Mar 21 '18 at 4:07
1

Apparently Codeship, the CI provider that I am using, had a different version of chromedriver that conflicted with my setup. Running chromedriver 2.35 fixed the problem.

Many thanks Aswini K for the effort provided though!

| improve this answer | |
0

Try with below changes on behat.yml file.

 extensions:
        Behat\MinkExtension\Extension:
            default_session: goutte
            javascript_session: selenium2
            goutte:
                guzzle_parameters:
                    ssl.certificate_authority: false
                    curl.options:
                        CURLOPT_SSL_VERIFYPEER: false
                        CURLOPT_CERTINFO: false
                        CURLOPT_TIMEOUT: 120
            selenium2:
              wd_host: "http://localhost:9515/wd/hub"
        Drupal\DrupalExtension\Extension:
            blackbox: ~
            api_driver: 'drupal'
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.