0

I am struggling to get the selenium hub docker to work with Magento2. I have used it in other frameworks like Django, but I'm struggling to make the connection in Magento2. I'm working on top of https://github.com/meanbee/docker-magento2 as a starting point.

Things I've tried to do to get some more information:

  • I can enter the CLI container and curl http://selenium_hub:4444/wd/hub/ to get a JSON response so I know the domain is resolving correctly.
  • I tried using just the firefox standalone container but I got the same error.
  • I can access the grid console from the host machine, so the containers are running.

Using the following server configuration I get an error

Error

The Selenium Server is not active on host http://selenium_hub/wd/hub/ at port 4444.

config.xml

<server>
    <item name="selenium"
          type="default"
          browser="Mozilla Firefox"
          browserName="firefox"
          host="http://selenium_hub/wd/hub/"
          port="4444"
          seleniumServerRequestsTimeout="90"
          sessionStrategy="shared">
       <desiredCapabilities>
          <browserName>firefox</browserName>
          <platform>ANY</platform>
       </desiredCapabilities>
    </item>
</server>

docker-compose.yml (selenium containers)

  selenium_hub:
      container_name: selenium_hub
      image: selenium/hub
      ports:
        - "4444:4444"

  selenium_chrome:
    container_name: selenium_chrome
    image: selenium/node-chrome-debug
    environment:
      - HUB_PORT_4444_TCP_ADDR=selenium_hub
      - HUB_PORT_4444_TCP_PORT=4444
    ports:
      - "5900:5900"
    depends_on:
      - selenium_hub

  selenium_firefox:
    container_name: selenium_firefox
    image: selenium/node-firefox-debug
    environment:
      - HUB_PORT_4444_TCP_ADDR=selenium_hub
      - HUB_PORT_4444_TCP_PORT=4444
    ports:
      - "5901:5900"
    volumes:
      - /dev/shm:/dev/shm
    depends_on:
      - selenium_hub

I'm still new to Selenium and Magento2, so any ideas are appreciated.

0

Follow-Up

Specifying only the host selenium_hub as opposed to http://selenium_hub/wd/hub/ proceeded with the connection, but resulted in a new error: Fatal error: Uncaught PHPUnit_Extensions_Selenium2TestCase_WebDriverException: Session [window] not available and is not among the last 1000 terminated sessions.

Either way, this new problem is no longer related to this question.

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.