elgalu / docker-selenium

[NOT MAINTAINED] Please use <https://github.com/SeleniumHQ/docker-selenium>
https://github.com/SeleniumHQ/docker-selenium
Other
1.42k stars 334 forks source link

Can't connect to Selenium server since 3.141.59-p15 #327

Closed JaZo closed 5 years ago

JaZo commented 5 years ago

Since tag 3.141.59-p15 I can't connect to the Selenium server and get errors like the following:

The Selenium Server is not active on host selenium at port 24444

When using tag 3.141.59-p14 everything is fine.

Docker commands

Operating System

Image version

Docker version

ndrake0027 commented 5 years ago

Similar issue, p15 is non-responsive. I am using it for phpunit tests. Individual tests the selenium web driver is giving responding with

Behat\Mink\Exception\DriverException: Could not open connection: Payload received from webdriver is valid but unexpected json: {
  "value": {
    "sessionId": "0e77b0c0c291f0c31c4782fc6bf6163f",
    "capabilities": {
      "acceptInsecureCerts": false,
      "browserName": "chrome",
      "browserVersion": "75.0.3770.80",
      "chrome": {
        "chromedriverVersion": "75.0.3770.8 (681f24ea911fe754973dda2fdc6d2a2e159dd300-refs\u002fbranch-heads\u002f3770@{#40})",
        "userDataDir": "\u002ftmp\u002f.com.google.Chrome.mepXSW"
      },
      "goog:chromeOptions": {
        "debuggerAddress": "localhost:37519"
      },
      "networkConnectionEnabled": false,
      "pageLoadStrategy": "normal",
      "platformName": "linux",
      "proxy": {
      },
      "setWindowRect": true,
      "strictFileInteractability": false,
      "timeouts": {
        "implicit": 0,
        "pageLoad": 300000,
        "script": 30000
      },
      "unhandledPromptBehavior": "dismiss and notify",
      "webdriver.remote.sessionid": "0e77b0c0c291f0c31c4782fc6bf6163f"
    }
  }
}

Nothing special in the logs either.

docker --version
Docker version 18.09.2, build 6247962

Rolled back to p14 and everything is working again.

sramgn commented 5 years ago

Same here. After the latest release (3.141.59-p15), all of my tests were failing when trying to connect to the server (Couldn't initialize driver -Unable to create new remote session). I had to roll back the image(s) to the below and works fine:

Docker Command:

docker run --rm -idt --name zalenium -p 4444:4444 -v /var/run/docker.sock:/var/run/docker.sock -v /tmp/videos:/home/seluser/videos --privileged dosel/zalenium start --desiredContainers 5 --maxTestSessions 5 --timeZone "America/Chicago" --maxDockerSeleniumContainers 10 --videoRecordingEnabled false --retentionPeriod 3

Exception:

Couldn't initialize driver -Unable to create new remote session

Caps:

desired capabilities = Capabilities [{browserName=chrome, javascriptEnabled=true, platformName=LINUX}], required capabilities = Capabilities [{}]

jeffhall-wk commented 5 years ago

~I really have no idea if this helps at all yet, but I did find this post on Medium https://medium.com/@alex.designworks/chromedriver-75-enforces-w3c-standard-breaking-behat-tests-460cad435545~

~Trying to get my test run to work with these new settings at the moment, I will update if it helps.~

Update: This did not seem to make a difference. 😢

diemol commented 5 years ago

@JaZo could you please share the logs?

das-peter commented 5 years ago

If you're running docker compose you should be able to use following snipped to fix the selenium version the zalenium container is using:

environment:
      # Use version pinning as workaround for:
      # https://github.com/elgalu/docker-selenium/issues/327
      SELENIUM_IMAGE_NAME: "elgalu/selenium:3.141.59-p14"

If you're using docker run - add -e SELENIUM_IMAGE_NAME="elgalu/selenium:3.141.59-p14" for the same effect.

Make sure you've the defined version ready to use by executing docker pull elgalu/selenium:3.141.59-p14 first.

JaZo commented 5 years ago

logs.zip

This file includes:

docker logs -f selenium > docker-logs.log
/var/log/cont/docker-selenium-status.log
/var/log/cont/selenium-hub-stderr.log
/var/log/cont/selenium-hub-stdout.log
/var/log/cont/selenium-node-chrome-stderr.log
/var/log/cont/selenium-node-chrome-stdout.log
/var/log/cont/selenium-node-firefox-stderr.log
/var/log/cont/selenium-node-firefox-stdout.log
/var/log/cont/supervisord.log
/var/log/cont/video-rec-stderr.log
/var/log/cont/video-rec-stdout.log
/var/log/cont/vnc-stderr.log
/var/log/cont/vnc-stdout.log
/var/log/cont/xmanager-stderr.log
/var/log/cont/xmanager-stdout.log
/var/log/cont/xterm-stderr.log
/var/log/cont/xterm-stdout.log
/var/log/cont/xvfb-stderr.log
/var/log/cont/xvfb-stdout.log

@diemol, are those what you need?

marijnz0r commented 5 years ago

@diemol, did you find a moment to take a look at the logs? I'm very interested in the outcome.

diemol commented 5 years ago

@JaZo I just checked the logs and I cannot see anywhere the message:

The Selenium Server is not active on host selenium at port 24444

Where are you seeing this message?

JaZo commented 5 years ago

The testing framework I use (phpunit-selenium) logs this message: https://github.com/giorgiosironi/phpunit-selenium/blob/3129be3c3a90bf46ef301817ea67c2f525451963/PHPUnit/Extensions/Selenium2TestCase.php#L324. The exception is thrown because cURL errors: https://github.com/giorgiosironi/phpunit-selenium/blob/8e4cf0271d82a44324e3dfebf0ea84c467b39317/PHPUnit/Extensions/Selenium2TestCase/Driver.php#L123. In this case the exception message is as follows:

Error connection[28] to http://selenium:24444/wd/hub/session: Operation timed out after 60001 milliseconds with 0 bytes received

JaZo commented 5 years ago

I just tried the same cURL command on the command line and it gives the same error.

curl -X POST -d '{"desiredCapabilities":{"browserName":"chrome"}}' -H "Content-type: application/json;charset=UTF-8" -H "Accept: application/json;charset=UTF-8" --max-time 60 http://selenium:24444/wd/hub/session

curl: (28) Operation timed out after 60000 milliseconds with 0 bytes received

diemol commented 5 years ago

@JaZo Those capabilities are JsonWireProtocol caps, Chrome & ChromeDriver 75 and above work in W3C mode by default, which means that the client needs to send W3C compatible capabilities or switch Chrome to work with W3C off while a migration path is found.

In this case, it is most likely that phpunit-selenium is not up to date.

Recent Selenium clients should send both types of capabilities, something like this

Closing as this is not a docker-selenium issue.

JaZo commented 5 years ago

@diemol, thanks for helping out and pointing me in the right direction!