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.

Connection reset by peer when doing getText() on ElementArrayFinder when SELENIUM_PROMISE_MANAGER is false

See original GitHub issue

Test 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:open
  • Created 6 years ago
  • Reactions:16
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

5reactions
kovalchuktcommented, Jun 1, 2018

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.

2reactions
pumboxcommented, Jun 6, 2018

@CrispusDH The documentation states that:

You can treat an ElementArrayFinder as an array of WebElements for most purposes, in particular, you may perform actions (i.e. click, getText) on them as you would an array of WebElements. The action will apply to every element identified by the ElementArrayFinder.

And, by the way, your solution also throws the same error.

Read more comments on GitHub >

github_iconTop 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 >

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