question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Getting random error from WebDriver - Connection reset by peer

See original GitHub issue

Bug report

I’m getting the next WebDriver error randomly in different parts of the tests:

WebDriverError: java.net.SocketException: Connection reset by peer (connect failed)

Doesn’t matter the action against the browser.

  • Node Version: 8.9.4
  • Protractor Version: 5.3
  • Browser(s): Chrome
  • Selenium: 3.11
  • ChromeDriver: 2.36
  • Operating System and Version: Mac OS - Sierra 10.12.6
  • Your protractor configuration file
const chai = require('chai');
const chaiAsPromised = require('chai-as-promised');

const frameworkPath = require.resolve('protractor-cucumber-framework');

module.exports = {
  allScriptsTimeout: 50000,
  seleniumAddress: 'http://localhost:4444/wd/hub',
  baseUrl: '[...]',

  resultJsonOutputFile: 'report.json',
  framework: 'custom',
  frameworkPath,
  capabilities: {
    browserName: 'chrome',
  },
  // How long to wait for a page to load.
  getPageTimeout: 50000,
  onPrepare: () => {
    chai.use(chaiAsPromised);
    // Disable Angular animations so e2e tests run more quickly
    browser.addMockModule('disableNgAnimate', () => {
      angular.module('disableNgAnimate', []).run(($animate) => {
        $animate.enabled(false);
      });
    });

    browser.ignoreSynchronization = true;

    browser.manage().timeouts().implicitlyWait(30000);
    browser.driver.manage().window().setSize(1300, 1000);
  },
  specs: [
    './e2e/features/*/*.feature',
  ],
  SELENIUM_PROMISE_MANAGER: false,
  cucumberOpts: {
    require: './e2e/features/*/*.js',
    format: 'progress-bar',
    keepAlive: false,
  },
};
  • Output from running the test
WebDriverError: java.net.SocketException: Connection reset by peer (connect failed)
           at Object.checkLegacyResponse (/Users/.../node_modules/selenium-webdriver/lib/error.js:546:15)
           at parseHttpResponse (/Users/.../node_modules/selenium-webdriver/lib/http.js:509:13)
           at doSend.then.response (/Users/.../node_modules/selenium-webdriver/lib/http.js:441:30)
           at <anonymous>
           at process._tickCallback (internal/process/next_tick.js:188:7)Error
           at ElementArrayFinder.applyAction_ (/Users/.../node_modules/protractor/built/element.js:459:27)
           at ElementArrayFinder.(anonymous function).args [as getAttribute] (/Users/.../node_modules/protractor/built/element.js:91:29)
           at ElementFinder.(anonymous function).args [as getAttribute] (/Users/.../node_modules/protractor/built/element.js:831:22)
           at HomePage.getFontNameFromCardCarousel (/Users/.../tests/qeguitests/e2e/pages/HomePage.js:91:148)
           at World.When (/Users/.../tests/qeguitests/e2e/features/steps_definitions/homepage_steps.js:99:33)
   - And I move to the "right" the carousel # tests/qeguitests/e2e/features/steps_definitions/homepage_steps.js:54

Issue Analytics

  • State:open
  • Created 6 years ago
  • Comments:6

github_iconTop GitHub Comments

4reactions
paweluscommented, Mar 16, 2018

Duplicate of #4693? Any getX() operation (eg. getText() or getAttribute()) done on ElementArrayFinder seems to cause this randomly when SELENIUM_PROMISE_MANAGER is set to false.

0reactions
janjadcommented, Jun 11, 2018

I’m also getting the error, but at least workaround with lower selenium server version works for me… See https://github.com/SeleniumHQ/selenium/issues/5611#issuecomment-396268295

Read more comments on GitHub >

github_iconTop Results From Across the Web

Random 'The connection was reset' webpage with Selenium
We use selenium to test whether we are able to browse. But sometimes intermittently, the selenium types the actual URL in the address...
Read more >
How to Fix the "ERR_CONNECTION_RESET" Error (5 Ways)
The first thing you want to do if you encounter the “ERR_CONNECTION_RESET” error is to determine whether your internet connection is working ...
Read more >
How to Fix with java.net.SocketException: Connection reset ...
If you are a client and getting this error while connecting to the server-side application then you can do the following things: 1....
Read more >
How does java net SocketException Connection reset happen
Most common issue for this problem occurring is when you close the socket, and then write more data on the output stream. By...
Read more >
Fix a random network Connection Reset issue in Docker ...
SocketException: Connection reset by peer: socket write error51 ... a service served by ClusterIP gets a random “connection reset”.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found