protractor icon indicating copy to clipboard operation
protractor copied to clipboard

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

Open MaximeHussenet opened this issue 8 years ago • 4 comments

Bug report

  • Node Version: 9.2.0
  • Protractor Version: 5.3.0
  • Angular Version: 1.5.11
  • Browser(s): Chrome
  • Operating System and Version macOS 10.13.3
  • Your protractor configuration file: conf file is pretty huge, I don't think it's relevant for this issue
  • A relevant example test:
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
  });
  }
  • Output from running the test:

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

  • Steps to reproduce the bug: Just run a test where you access Google, you should be getting the issue randomly

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

MaximeHussenet avatar Apr 04 '18 16:04 MaximeHussenet

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

dichovsky avatar Apr 07 '18 19:04 dichovsky

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?

DanielLipowicz avatar Apr 16 '18 22:04 DanielLipowicz

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

Airpwn0 avatar May 25 '18 12:05 Airpwn0

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');
});

awarecan avatar May 30 '18 01:05 awarecan