Running Nightwatch tests on CI in Chrome. Sometimes (about once in 5 builds) I encounter following error, in one of the tests. Every test before this one works fine.
I have the latest Chromedriver and Selenium standalone server.
I figured that the problem is that Selenium server crashes mid-request, tough I don't know why.
Error retrieving a new session from the selenium server
Connection refused! Is selenium server started?
{ Error: socket hang up
at createHangUpError (_http_client.js:254:15)
at Socket.socketCloseListener (_http_client.js:286:23)
at emitOne (events.js:101:20)
at Socket.emit (events.js:188:7)
at TCP._handle.close [as _onclose] (net.js:498:12) code: 'ECONNRESET' }
Also here is part of my nightwatch.json
that takes care of selenium.
"selenium": {
"start_process": true,
"server_path": "scripts/Nightwatch/selenium-server-standalone-3.0.1.jar",
"log_path": "app/E2E/reports/selenium",
"port": 4444,
"cli_args": {
"webdriver.chrome.driver": "scripts/Nightwatch/chromedriver"
}
}
Any ideas why is Selenium crashing and how to fix this issue?
Had the exact same issue with selenium/chromedriver on Codeship. I tried downgrading selenium to 2.53.1 to no avail. Verbose logging showed no helpful info, just the selenium server suddenly not starting new sessions somewhere randomly in our tests.
What appeared to work was adding the following to our test commands:
# Prevent chrome deadlock
export DBUS_SESSION_BUS_ADDRESS=/dev/null
Issue is described here: https://github.com/SeleniumHQ/docker-selenium/issues/87
It looks like there is an issue with certain docker containers which would explain it happening on a CI while locally working just fine.
The same exception message is displayed (every time a build is run) when chrome is not configured correctly in nightwatch.json. Specifically it requires the "--no-sandbox" option to be provided e.g
"chrome": {
"desiredCapabilities": {
"browserName": "chrome",
"javascriptEnabled": true,
"acceptSslCerts": true,
"chromeOptions": {
"args" : ["--no-sandbox"]
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With