selenium with behat : Unable to find provider for session

So I’m trying to configure selenium in a docker container, to use with behat, and the hub has the status not ready when I reach http://localhost:4444/status :

{
  "value": {
    "ready": false,
    "message": "Selenium Grid not ready.",
    "nodes": [
      {
        "id": "f746de23-58e4-499d-85fd-9bad4f904488",
        "uri": "http:u002fu002f172.22.0.5:5555",
        "maxSessions": 2,
        "stereotypes": [
          {
            "capabilities": {
              "browserName": "chrome"
            },
            "count": 2
          }
        ],
        "sessions": [
        ]
      }
    ]
  }
}

And when I run the tests :

Could not open connection: Payload received from webdriver is valid but unexpected json: {
        "value": {
          "error": "session not created",
          "message": "Unable to find provider for session: Capabilities {browser: firefox, browserName: chrome, ignoreZoomSetting: false, name: Behat feature suite, tags: [509f70556c1c, PHP 7.4.9]}, Capabilities {browserName: chrome}, Capabilities {browserName: firefox}, Capabilities {}nBuild info: version: '4.0.0-alpha-7', revision: '117b9d61c9'nSystem info: host: '7f39dcd595c7', ip: '172.22.0.2', os.name: 'Linux', os.arch: 'amd64', os.version: '4.19.76-linuxkit', java.version: '1.8.0_265'nDriver info: driver.version: unknown",
          "stacktrace": "org.openqa.selenium.SessionNotCreatedException: Unable to find provider for session: Capabilities {browser: firefox, browserName: chrome, ignoreZoomSetting: false, name: Behat feature suite, tags: [509f70556c1c, PHP 7.4.9]}, Capabilities {browserName: chrome}, Capabilities {browserName: firefox}, Capabilities {}nBuild info: version: '4.0.0-alpha-7', revision: '117b9d61c9'nSystem info: host: '7 (BehatMinkExceptionDriverException)

I tried many configuration, mostly in the wd_host param in behat.yml, but everything I tried (different url, different port…) brought me errors.

My docker-composer.yml:

version: '3'

services:
  chrome:
    image: selenium/node-chrome:4.0.0-alpha-7-prerelease-20200907
    volumes:
      - /dev/shm:/dev/shm
    depends_on:
      - selenium-hub
    environment:
      - SE_EVENT_BUS_HOST=selenium-hub
      - SE_EVENT_BUS_PUBLISH_PORT=4442
      - SE_EVENT_BUS_SUBSCRIBE_PORT=4443
    ports:
      - "6900:5900"

  selenium-hub:
    image: selenium/hub:4.0.0-alpha-7-prerelease-20200907
    container_name: selenium-hub
    ports:
      - "4442:4442"
      - "4443:4443"
      - "4444:4444"
    restart: always

My behat.yml:

extensions:
    BehatMinkExtension:
        base_url: "http://localhost"
        browser_name: 'chrome'
        sessions:
            my_session:
                selenium2:
                    wd_host: "http://selenium-hub:4444"
                    browser: chrome
                    capabilities: { "browserName": "chrome"}
    FriendsOfBehatSymfonyExtension: null

For a moment I thought it was related to the "capabilities" parameter so I tried to put things in it but it didn’t change anything, and I guess if it was just that, the hub would still tell me that it is ready.

Any idea ? Thank you

Source: Symfony Questions

Was this helpful?

0 / 0

Leave a Reply 0

Your email address will not be published. Required fields are marked *