Behat / MinkExtension

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

Cannot launch browser to execute automation #366

Closed bhadmus closed 4 years ago

bhadmus commented 4 years ago

I am learning Behat and I have been trying for days to get this to work.

Here is my composer.json file:

{

    "require-dev": {
        "behat/behat": "3.0.*",
        "behat/mink": "*",
        "behat/mink-extension":"^2.3.1",
        "behat/mink-goutte-driver": "*",
        "behat/mink-browserkit-driver": "*"

    },
    "require": {
        "behat/mink-selenium2-driver": "*"
    }
}

and here is my behat.yml file:

default:

  extensions:
    Behat\MinkExtension:
      browser_name: 'chrome'
      goutte: ~
      javascript_session: selenium2
      selenium2:
        wd_host: http://127.0.0.1:4444/wd/hub
        capabilities: {"browserName": "chrome", "browser": "chrome", 'chrome': {'switches': ['--disable-gpu', '--window-size=1280,1600']}, "marionette": true}
      base_url: 'https://www.google.com/'

when I run vendor/bin/behat, I get the error below:

Could not open connection: Cannot define class using reflection (Behat\Mink\Exception\DriverException)

Please help me.

ciaranmcnulty commented 4 years ago

Take a look at the configuration reference for sessions: https://github.com/Behat/MinkExtension/blob/master/doc/index.rst#sessions

You seem be missing the sessions key

bhadmus commented 4 years ago

Take a look at the configuration reference for sessions: https://github.com/Behat/MinkExtension/blob/master/doc/index.rst#sessions

You seem be missing the sessions key

Thank you for your reply, @ciaranmcnulty

Is this what it should look like? If so, it didn't work.

default:

  extensions:
    Behat\MinkExtension:
      sessions:
          first_session:
            selenium2: ~
          second_session:
            goutte: ~
          third_session:
            selenium2: ~
      browser_name: 'chrome'
      goutte: ~
      javascript_session: selenium2
      selenium2:
        wd_host: http://127.0.0.1:4444/wd/hub
        capabilities: {"browserName": "chrome", "browser": "chrome", 'chrome': {'switches': ['--disable-gpu', '--window-size=1280,1600']}, "marionette": true}
      base_url: 'https://www.google.com/'

Please help me correct it if I am wrong.

ciaranmcnulty commented 4 years ago

you have goutte: ~ in there twice, and the selenium2: ... stuff should be under the sessions

I'm going to close this as we're in tech support territory rather than there being an issue