Behat / MinkExtension

Mink extension (tight integration and configuration) for Behat
MIT License
636 stars 276 forks source link

Selenium2: Firefox is launched with browser_name: chrome since the latest release #309

Closed ArthurHoaro closed 6 years ago

ArthurHoaro commented 6 years ago

The latest release includes this change in Selenium2Factory which for some reason makes Selenium run Firefox instead of Chrome.

+   ->booleanNode('marionette')->defaultFalse()->end()

Config:

default:
  extensions:
    Behat\MinkExtension:
      browser_name: chrome
      selenium2:
        wd_host: "http://172.17.0.1:4444/wd/hub"
        capabilities:
          chrome:
            switches:
              - "--disable-gpu"
              - "--headless"

Selenium log with the mentioned change:

Capabilities {browser: firefox, browserName: chrome, chrome.extensions: [], chrome.switches: [--disable-gpu, --headless, --window-size=1920,1080, --whitelisted-ips=""], chromeOptions: {args: [--disable-gpu, --headless, --window-size=1920,1080, --whitelisted-ips=""], extensions: []}, ignoreZoomSetting: false, marionette: false, name: Behat feature suite, tags: [php, PHP 5.6.31]} matched class org.openqa.selenium.remote.server.ServicedSession$Factory (provider: org.openqa.selenium.firefox.XpiDriverService)

Selenium log without the mentioned change:

Capabilities {browser: firefox, browserName: chrome, chrome.extensions: [], chrome.switches: [--disable-gpu, --headless, --window-size=1920,1080, --whitelisted-ips=""], chromeOptions: {args: [--disable-gpu, --headless, --window-size=1920,1080, --whitelisted-ips=""], extensions: []}, ignoreZoomSetting: false, name: Behat feature suite, tags: [php, PHP 5.6.31]} matched class org.openqa.selenium.remote.server.ServicedSession$Factory (provider: org.openqa.selenium.chrome.ChromeDriverService)

paulgibbs commented 6 years ago

My project's also run into what seems to be the same problem. On Travis-CI, using this alongside Behat (set to use Chrome) and Selenium, without Firefox installed, we see a "Could not open connection: Timed out waiting 45 seconds for Firefox to start" error: https://travis-ci.org/paulgibbs/behat-wordpress-extension/jobs/308000669

Downgrading Behat/MinkExtension to v2.2 resolved the issue for me.

omordach commented 6 years ago

I have the same problem after updating behat/mink-extension from v2.2 to v2.3.0.

When I run tests Firefox is launched instead of Chrome and I got an error:

Could not open connection: Timed out waiting 45 seconds for Firefox to start.
      Build info: version: '3.7.1', revision: '8a0099a', time: '2017-11-06T21:07:36.161Z'
      System info: host: 'oleg-15IAP', ip: '127.0.1.1', os.name: 'Linux', os.arch: 'amd64', os.version: '4.10.0-40-generic', java.version: '9.0.1'
      Driver info: driver.version: unknown (Behat\Mink\Exception\DriverException)

Downgrading Behat/MinkExtension tov2.2 resolved the issue.

My behat.yml

default:
    extensions:
        Laracasts\Behat: ~
        Behat\MinkExtension:
            default_session: laravel
            base_url: https://test.test/
            javascript_session: selenium2
            browser_name: chrome
            laravel: ~
            goutte: ~ 
            selenium2: ~

I'm using latest selenium-server-standalone-3.7.1 and Chromedriver=2.33.506092

Trogie commented 6 years ago

Downgrading is of course a solution. But also removing the line

from the file vendor/behat/mink-extension/src/Behat/MinkExtension/ServiceContainer/Driver/Selenium2Factory.php solves this problem.

Didn't look why this only pops up now. It's strange because this line was added already on June 17, 2016!! See this commit: https://github.com/Behat/MinkExtension/commit/390f237f2594a2aa9618c17814cab9159292b8d2

IwfY commented 6 years ago

@Trogie Because there was no release since February 2016. Many people may require this bundle as "^2.2" and get an update now.

Trogie commented 6 years ago

Yes off course... Hmmmzz even on my projects that only depended on minkextension I seem to have used 2.2 all the time.

cspitzlay commented 6 years ago

As a workaround, I got chrome to launch by adding "marionette": true to the capabilities. That probably amounts to the same as removing the line ->booleanNode('marionette')->defaultFalse()->end() from the code.

m4olivei commented 6 years ago

We're using the patch in #311 which corrects the issue.