protractor-jasmine2-screenshot-reporter icon indicating copy to clipboard operation
protractor-jasmine2-screenshot-reporter copied to clipboard

WebDriver.takeScreenshot() error

Open ignamiguel opened this issue 7 years ago • 4 comments

Hi guys,

I'm getting the WebDriverError: java.net.SocketException: Connection reset by peer (connect failed) apparently from this task: From: Task: WebDriver.takeScreenshot()

As I can see in the console output, the protractor-jasmine2-screenshot-reporter is trying to take a screenshot and it's now throwing that error.

Here is the complete output.

1) Given a user with entitlement available when the user executes the workflow then the application is successfully executed
  Message:
    WebDriverError: java.net.SocketException: Connection reset by peer (connect failed)
  Stack:
    WebDriverError: java.net.SocketException: Connection reset by peer (connect failed)
        at WebDriverError (/Users/ignamiguel/Dev/automation-mozart/automation-mozart-ui/node_modules/selenium-webdriver/lib/error.js:27:5)
        at Object.checkLegacyResponse (/Users/ignamiguel/Dev/automation-mozart/automation-mozart-ui/node_modules/selenium-webdriver/lib/error.js:505:15)
        at parseHttpResponse (/Users/ignamiguel/Dev/automation-mozart/automation-mozart-ui/node_modules/selenium-webdriver/lib/http.js:509:13)
        at doSend.then.response (/Users/ignamiguel/Dev/automation-mozart/automation-mozart-ui/node_modules/selenium-webdriver/lib/http.js:440:13)
        at process._tickCallback (internal/process/next_tick.js:109:7)
    From: Task: WebDriver.takeScreenshot()
        at thenableWebDriverProxy.schedule (/Users/ignamiguel/Dev/automation-mozart/automation-mozart-ui/node_modules/selenium-webdriver/lib/webdriver.js:816:17)
        at thenableWebDriverProxy.takeScreenshot (/Users/ignamiguel/Dev/automation-mozart/automation-mozart-ui/node_modules/selenium-webdriver/lib/webdriver.js:1092:17)
        at run (/Users/ignamiguel/Dev/automation-mozart/automation-mozart-ui/node_modules/protractor/lib/browser.ts:66:27)
        at ProtractorBrowser.to.(anonymous function) [as takeScreenshot] (/Users/ignamiguel/Dev/automation-mozart/automation-mozart-ui/node_modules/protractor/lib/browser.ts:74:12)
        at /Users/ignamiguel/Dev/automation-mozart/automation-mozart-ui/node_modules/protractor-jasmine2-screenshot-reporter/index.js:568:23
        at /Users/ignamiguel/Dev/automation-mozart/automation-mozart-ui/node_modules/lodash/lodash.js:4944:15
        at baseForOwn (/Users/ignamiguel/Dev/automation-mozart/automation-mozart-ui/node_modules/lodash/lodash.js:3001:24)
        at /Users/ignamiguel/Dev/automation-mozart/automation-mozart-ui/node_modules/lodash/lodash.js:4913:18
        at Function.forEach (/Users/ignamiguel/Dev/automation-mozart/automation-mozart-ui/node_modules/lodash/lodash.js:9359:14)
        at Jasmine2ScreenShotReporter.specDone (/Users/ignamiguel/Dev/automation-mozart/automation-mozart-ui/node_modules/protractor-jasmine2-screenshot-reporter/index.js:564:7)

Any ideas? Is this a known issue? Regards

ignamiguel avatar Aug 14 '17 18:08 ignamiguel

Nope, I haven't actually seen this one yet. I wonder what could be the problem here - the reporter / webdriver itself shouldn't be doing any network requests to begin with when it takes a screenshot.

I'm not sure if that should matter, but perhaps your application does some network request that is not completed yet when your test finishes?

mlison avatar Aug 15 '17 06:08 mlison

I apologize in advance if this is not a reporter issue.

I share some workarounds I'm doing:

  1. If the reporter is removed from the config file (turned off), the SocketException is not thrown.

  2. The javadoc for SocketException states that it is Thrown to indicate that there is an error in the underlying protocol such as a TCP error I read that "Connection reset by peer" generally means that the remote system closed the connection. My understanding is that some component (i.e. reporter, protractor, webdriver manager, chromedriver, chrome) is closing the connection for some reason.

These are the version I'm using:

"protractor": "^5.1.1"
"protractor-jasmine2-screenshot-reporter": "^0.3.5"
"webdriver-manager": "^12.0.6"
"selenium-webdriver": "3.0.1"

ignamiguel avatar Aug 15 '17 13:08 ignamiguel

Have u managed to resolve this issue, since i have the same problem? "protractor": "5.4.2" "protractor-jasmine2-screenshot-reporter": "^0.5.0" "webdriver-manager": "12.1.6" "selenium-webdriver": "chromedriver=71.0.3578.80"

x-max avatar Sep 17 '19 08:09 x-max

@x-max not really, I haven't had much time for this project as of late.

mlison avatar Sep 17 '19 08:09 mlison