Sewenium Hang Up Stopwatch

Running Nightwatch CI tests in Chrome. Sometimes (approximately once in 5 lines) I meet the following error in one of the tests. Each test before this works great.

I have the latest standalone Chromedriver and Selenium server.

I realized that the problem is that the Selenium server crashes in the middle of the request, 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 a part of mine nightwatch.jsonthat 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 Selenium is crashing and how to solve this problem?

+4
source share
4 answers

/chromedriver . 2.53.1 . , - .

, , :

# Prevent chrome deadlock
export DBUS_SESSION_BUS_ADDRESS=/dev/null

: https://github.com/SeleniumHQ/docker-selenium/issues/87

, , , CI, .

+4

( , ), nightwatch.json. , "-no-sandbox",

"chrome": {
  "desiredCapabilities": {
  "browserName": "chrome",
  "javascriptEnabled": true,
  "acceptSslCerts": true,
  "chromeOptions": {
    "args" : ["--no-sandbox"]
  }
}
+3

. Fix: . 127.0.0.1 localhost

+1

args, Connection xvfb .

chrome: {
  silent: false,
  retry_attempts: 1,
  desiredCapabilities: {
    browserName: 'chrome',
    javascriptEnabled: true,
    acceptSslCerts: true,
    chromeOptions: {
      args: [
        '--disable-gpu --no-sandbox --headless --window-size=1920,1080 --verbose'
      ]
    }
  }
},

, :

      args: [
        'disable-gpu', 'no-sandbox', 'headless', 'window-size=1920,1080', 'verbose'
      ]

xvfb - !

0

Source: https://habr.com/ru/post/1665887/


All Articles