angular / protractor

E2E test framework for Angular apps
http://www.protractortest.org
MIT License
8.75k stars 2.31k forks source link

java.net.ConnectException: Connection refused (Connection refused) #4763

Open MaximeHussenet opened 6 years ago

MaximeHussenet commented 6 years ago

Bug report

pickGoogleFromList(){
    element.all(by.cssContainingText('span', 'Google Calendar')).first().click();
  }
fillOutGoogleData(){
    browser.getAllWindowHandles().then(function(handles) {
    browser.switchTo().window(handles[1]);
    element(by.xpath('//*[@id="identifierId"]')).sendKeys(emailAddress);
    browser.actions().sendKeys(protractor.Key.ENTER).perform(); // send ENTER
    element(by.xpath('//*[@id="password"]/div[1]/div/div[1]/input')).sendKeys(password);
    browser.actions().sendKeys(protractor.Key.ENTER).perform(); // send ENTER
  });
  }

Failed: java.net.ConnectException: Connection refused (Connection refused)

URL is our dev cluster, but in this case we're targeting Google on a separate tab or window

dichovsky commented 6 years ago

I have the same random exception (WebDriverError: java.net.ConnectException: Connection refused: connect) Node Version: 8.5.0 Protractor Version: 5.3.1 Angular Version: 5.2.9 Browser(s): Chrome driver 2.37 Operating System and Version Windows 10 Pro x64

DanielLipowicz commented 6 years ago

Same issue here, random as well: WebDriverError: java.net.ConnectException: Connection refused: connect From: Task: WebDriver.manage().deleteAllCookies() or From: Task: WebDriver.findElements(By(css selector, #passwordNext)) or any other driver task.

protractor 5.2.0 || 5.3.1 chromedriver 2.37.544315 webdriver-manager 12.0.6 node 8.9.4 windows 7 pro

any idea?

Airpwn0 commented 6 years ago

The Selenium server/driver can only handle a specific amount of parallel requests and all functions with concurrent requests can hang up Selenium.

4706

awarecan commented 6 years ago

That is an issue in selenium-webdriver. Here is my patch to resolve it (only work in protractor/selenium-webdriver 3.6.0)

var fs = require('fs');

var httpIndexFile = 'node_modules/selenium-webdriver/http/index.js';
fs.readFile(httpIndexFile, 'utf8', function (err, data) {
    if (err)
        throw err;

    var result = data.replace(/\(e.code === 'ECONNRESET'\)/g, "(e.code === 'ECONNRESET' || e.code === 'ECONNREFUSED')");
    console.log(`Patching ${httpIndexFile}`)
    fs.writeFileSync(httpIndexFile, result, 'utf8');
});