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.
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,
},
};
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
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.
Yeah, totally could be duplicated.
For me it's only happening on Chrome, Firefox work good
Also seeing this:
Node: 8.11.0
Protractor: 5.3.1
selenium-webdriver: 2.53.43
are you guys sure is this related to Protractor, I am seeing it in WebdriverIO too?
Yup, same here, very intermittent though. Using async/await, but couldn't get .each() or .map() to work at all really, having some luck with .get(#).... like so (still get the same error, but less):
let length:number = await pageTracker.amountButtons.count();
for(var i =0; i<length; i++) {
await pageTracker.amountButtons.get(i).click();
}
Because couldn't just do (like I would like to), because of the above error all the time:
pageTracker.amountButtons.each(async (amountBtn) => await amountBtn.click());
Node: 8.11.1
Protractor: 5.3.3
chromedriver_2.39
selenium-server-standalone-3.12.0.jar
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
Most helpful comment
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.