Connection reset by peer when doing getText() on ElementArrayFinder when SELENIUM_PROMISE_MANAGER is false
See original GitHub issueTest execution interrupts on attempt to run .getText() on ElementArrayFinder Following error is displayed on attempt to run test with selenium server option:
✖ Given I execute socketException test # src/asyncAwaitProtractor.js:182 WebDriverError: java.net.SocketException: Connection reset by peer (connect failed)
And this, in case of direct connection:
✖ Given I execute socketException test # src/asyncAwaitProtractor.js:182 Error: EPIPE write EPIPE
The issue is not reproducing on Firefox.
- Node Version:
8.9.4
- Protractor Version:
5.3.0
- Angular Version:
1.5.7
- Browser(s):
chrome
- Operating System and Version
Mac OSX
config file
const config = {
SELENIUM_PROMISE_MANAGER: false,
baseUrl: "http://www.protractortest.org/#/",
seleniumAddress: 'http://localhost:4444/wd/hub',
capabilities: {
browserName: 'chrome',
shardTestFiles: false,
maxInstances: 1
},
specs: [
'./features/*.feature'
],
ignoreUncaughtExceptions: true,
disableChecks: true,
framework: 'custom',
frameworkPath: './node_modules/protractor-cucumber-framework',
restartBrowserBetweenTests: true,
cucumberOpts: {
require: './src/*.js',
strict: true,
format: 'json:results.json',
defaultTimeoutInterval: 160000,
tags: "@socketException"
},
onPrepare: onPrepare,
onComplete: onComplete
};
async function onPrepare() {
const {Given, Then, When} = require('cucumber');
global.Given = Given;
global.When = When;
global.Then = Then;
}
async function onComplete() {
console.log("suite tests complete --> ");
}
exports.config = Object.assign({}, config);
package.json
{
"name": "socketException",
"version": "1.1.0",
"dependencies": {
"protractor": "5.3.0",
"protractor-cucumber-framework": "4.2.0"
},
"devDependencies": {
"cucumber": "4.0.0"
}
}
test example
Given("I execute socketException test", async function () {
let btnsList = () => {return $$("h2")};
await browser.get(browser.baseUrl);
console.log(await btnsList().getText());
console.log(await btnsList().getText());
console.log(await btnsList().getText());
console.log(await btnsList().getText());
console.log(await btnsList().getText());
});
Issue Analytics
- State:
- Created 6 years ago
- Reactions:16
- Comments:7 (2 by maintainers)
Top Results From Across the Web
Protractor: Store ElementArrayFinder getTexts in Array and ...
The root cause return empty array is return data is executed sync, but data.push(text) is executed async. so when getAllTexts() execution ...
Read more >ElementArrayFinder - Protractor
You can treat an ElementArrayFinder as an array of WebElements for most purposes, in particular, you may perform actions (i.e. click, getText) on...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
any intention for this to be fixed soon, guys? seems this error occurs even when more than one element found by $, and first one is used by default. In case like this it’s really hard to tell where the error is, which makes migration to async/await more than painful.
@CrispusDH The documentation states that:
And, by the way, your solution also throws the same error.