I was using protactor 1.8 using multiCapabilities with 7 chrome browser instances running parallel. I was always able to run my test suit successfully. I recently updated my protractor to version 3.2.2. My test suit started to intermittently return the following error message.
Error: EADDRINUSE connect EADDRINUSE 127.0.0.1:4444
[chrome #31] at ClientRequest.<anonymous> (C:\myAppe2e\node_modules\protractor\node_modules\selenium-webdriver\http\index.js:365:15)
[chrome #31] at emitOne (events.js:77:13)
[chrome #31] at ClientRequest.emit (events.js:169:7)
[chrome #31] at Socket.socketErrorListener (_http_client.js:267:9)
[chrome #31] at emitOne (events.js:77:13)
[chrome #31] at Socket.emit (events.js:169:7)
[chrome #31] at emitErrorNT (net.js:1253:8)
[chrome #31] at nextTickCallbackWith2Args (node.js:442:9)
[chrome #31] at process._tickCallback (node.js:356:17)
[chrome #31] From: Task: WebElement.isSelected()
[chrome #31] at WebDriver.schedule (C:\myAppe2e\node_modules\protractor\node_modules\selenium-webdriver\lib\webdriver.js:344:17)
[chrome #31] at WebElement.schedule_ (C:\myAppe2e\node_modules\protractor\node_modules\selenium-webdriver\lib\webdriver.js:1712:25)
[chrome #31] at WebElement.isSelected (C:\myAppe2e\node_modules\protractor\node_modules\selenium-webdriver\lib\webdriver.js:2023:17)
[chrome #31] at actionFn (C:\myAppe2e\node_modules\protractor\built\element.js:82:76)
[chrome #31] at Array.map (native)
[chrome #31] at C:\myAppe2e\node_modules\protractor\built\element.js:374:46
[chrome #31] at Promise.invokeCallback_ (C:\myAppe2e\node_modules\protractor\node_modules\selenium-webdriver\lib\promise.js:1329:14)
[chrome #31] at TaskQueue.execute_ (C:\myAppe2e\node_modules\protractor\node_modules\selenium-webdriver\lib\promise.js:2790:14)
[chrome #31] at TaskQueue.executeNext_ (C:\myAppe2e\node_modules\protractor\node_modules\selenium-webdriver\lib\promise.js:2773:21)
[chrome #31] at C:\myAppe2e\node_modules\protractor\node_modules\selenium-webdriver\lib\promise.js:2652:27
[chrome #31] at C:\myAppe2e\node_modules\protractor\node_modules\selenium-webdriver\lib\promise.js:639:7
[chrome #31] at process._tickCallback (node.js:369:9)
[chrome #31] Error
[chrome #31] at ElementArrayFinder.applyAction_ (C:\myAppe2e\node_modules\protractor\built\element.js:371:27)
[chrome #31] at ElementArrayFinder._this.(anonymous function) [as isSelected] (C:\myAppe2e\node_modules\protractor\built\element.js:83:30)
[chrome #31] at ElementFinder._this.(anonymous function) [as isSelected] (C:\myAppe2e\node_modules\protractor\built\element.js:685:22)
It's not the webdriver config that's the issue here, most likely. Changing the port might help initially, but if a program is consuming the available ports on your VM/machine, this fix won't help for too long. This is the same issue I faced; so I created a batch script (before running my automation) that ran:
net session /delete
And that shut down all open, TIME_WAIT and CLOSE_WAIT connections. Reran my tests immediately after and they ran without the EADDRINUSE error. Hope this helps as at least a workaround. Good luck!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With