"Port 5858 is already in use" when using browser.pause more then once
I have the line browser.pause(); in a beforeEach-function in my Protractor spec and I thought it would act as a breakpoint for me to pause before every it and check out the browser before continuing with the command d to continue to the next debugger statement (which should be the beforeEach again). But when Protractor reach beforeEach for the second time I get the error:
Port 5858 is already in use. Please specify another port to debug.
[launcher] Process exited with error code 1
Isn't this how you're supposed to use the pause function? What's purpose of the d-command if you can't use browser.pause() multiple times in the code?
Encountering the exact same issue.
+1
I'm not sure what the implications of this are, but you can specify the port as a param to browser.pause(). So something like
$('button').click();
browser.pause(5001);
$('#close').click();
browser.pause(5002);
would allow you to pause multiple times without crashing.
In which case, this would seem like expected behavior.
Maybe a bit more information in the documentation would help, but this feature is marked as beta/unstable so that makes sense.
I am also experiencing this. I have tried both closing the debugger and continuing to the next debugger statement with the same result.
I think the hesitance to use the multiple ports is that this would appear to leave the ports open, so if you are running a long test suite, with multiple browser.pause, you would have a number of debug ports open. As well, the OPs issue is hitting the pause in the beforeEach, so this would require incrementing a debug variable after each pause to avoid the issue.
As a temporary workaround, I have put the following into our protractor.conf.js onPrepare function:
global.debugPortNumber = 5000;
global.initiateDebug = function() {
browser.pause(debugPortNumber);
debugPortNumber++;
};
Then I can call initiateDebug() from wherever and not have to worry about manually updating the port number.
Same issue here -> http://screencast.com/t/8CFTi1eGD0
+1
I'm seeing this now even when running pause just once. @hankduan do you have time to take a look?
+1 hitting same issue.
+1
Fixed here: https://github.com/angular/protractor/pull/2763
@hankduan I tried out you #hack branch because I ran into the port problem.
I have a node project using
$ node --version
v5.2.0
$ npm --version
3.3.12
packages.json ->
...
"protractor": "[email protected]:hankduan/protractor.git#hack",
"webdriver-manager": "^7.0.1",
"jasmine-core": "^2.3.4",
"karma": "0.13.8",
"karma-jasmine": "^0.3.5",
using you branch I run some e2e tests ~ (https://github.com/angular/protractor/blob/master/debugging/failure_spec.js)
$ ./node_modules/.bin/protractor debug protractor.conf.js
raises:
Using the selenium server at http://localhost:4444/wd/hub
[launcher] Running 1 instances of WebDriver
Starting debugger agent.
Debugger listening on port 5858
debug> connecting to localhost:5858 ... ok
debug> break in timers.js:57
55 };
56
>57 function listOnTimeout() {
58 var msecs = this.msecs;
59 var list = this;
debug> c
There was an internal error in Node's debugger. Please report this bug.
read EIO
cError: read EIO
at exports._errnoException (util.js:856:11)
at TTY.onread (net.js:545:26)
debug> debug> Segmentation fault (core dumped)
is this a nodejs or a protractor issue ?
if its a pure nodejs issue I have already added a comment to an existing issue https://github.com/nodejs/node-v0.x-archive/issues/8030#issuecomment-165433998
which node version do you / others use successfully for protractor debugging ?
That branch is for using Protractor with multiple browser.pause, not debug.
If all you did was add a debug to the commandline and did not touch the spec file, AND if the spec file runs without the debug property, then chances are it's a node issue, since it is controlled entirely by node.
And just as a background on what the debug command does, protractor simply calls node with --nodeDebug. See https://github.com/angular/protractor/blob/master/lib/cli.js
That being said, I have not been able to reproduce your issue (I've used 4.x and 5.0)
@hankduan ok I get the debugger thing and leaves to out for now.
I should have made it more clear that I also have an e2e test with multiple browser.pause() along the failure_spec.js:
describe('portal', function() {
it('must provide login', function() {
browser.get('http://localhost:3000');
browser.pause();
element(by.model('email')).sendKeys('an-email');
element(by.model('password')).sendKeys('a-password');
var selector = by.cssContainingText('a,button', 'Sign in');
var button = browser.findElement(selector);
button.click();
browser.pause();
expect(element.all(by.css('.search-inner')).count()).toEqual(1);
});
});
now I downgrade to node 5.0.0
and look up port 5858 usage
$ netstat -ant | grep 5858
// empty
and use your protractor branch. now I get 'the port already in use' error:
$ ./node_modules/.bin/protractor debug protractor.conf.js
Using the selenium server at http://localhost:4444/wd/hub
[launcher] Running 1 instances of WebDriver
Starting debugger agent.
Debugger listening on port 5858
debug> connecting to localhost:5858 ... ok
debug> break in timers.js:56
54 };
55
>56 function listOnTimeout() {
57 var msecs = this.msecs;
58 var list = this;
debug>
debug> debug> Started
Port 5858 is already in use. Please specify another port to debug.
[launcher] Process exited with error code 1
any hints further suggestions ?
I naively tried with one pause only:
browser.pause(5860);
ran the test again
$ ./node_modules/.bin/protractor debug protractor.conf.js
...
Encountered browser.pause(). Attaching debugger...
------- WebDriver Debugger -------
Starting WebDriver debugger in a child process. Pause is still beta, please report issues at github.com/angular/protractor
press c to continue to the next webdriver command
press ^D to detach debugger and resume code execution
type "repl" to enter interactive mode
type "exit" to break out of interactive mode
(node) warning: possible EventEmitter memory leak detected. 11 error listeners added. Use emitter.setMaxListeners() to increase limit.
Trace
at Client.addListener (events.js:239:17)
at Client.Readable.on (_stream_readable.js:665:33)
at connectWithRetry (/project/node_modules/protractor/lib/debugger/debuggerCommons.js:33:10)
at null._onTimeout (/project/node_modules/protractor/lib/debugger/debuggerCommons.js:38:15)
at Timer.listOnTimeout (timers.js:92:15)
/project/node_modules/protractor/lib/debugger/debuggerCommons.js:35
throw e;
^
Error: connect EALREADY 127.0.0.1:5860 - Local (127.0.0.1:56184)
at Object.exports._errnoException (util.js:860:11)
at exports._exceptionWithHostPort (util.js:883:20)
at connect (net.js:841:14)
at net.js:984:7
at GetAddrInfoReqWrap.asyncCallback [as callback] (dns.js:63:16)
at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:82:10)
but I running out of ideas how to solve it...
Run it as ./node_modules/.bin/protractor protractor.conf.js, not ./node_modules/.bin/protractor debug protractor.conf.js. Let me know if that fixes your problem.
@hankduan thank you for the patience without the debug param the browser.pause() works.
This is out in the 3.1.0 release!
This seems to be happening again on 3.3.0. I tried 3.2.0 and 3.1.0 and it works on both.
Error:
P:\test>node node_modules\protractor\bin\protractor conf.js
...
wd-debug> Resuming code execution
Port 5858 is already in use. Please specify another port to debug.
[15:20:45] E/launcher - Process exited with error code 1
Same thing happens when I use protractor conf.js (global install is also v3.3.0)
Test files:
// conf.js
exports.config = {
framework: 'jasmine',
seleniumAddress: 'http://localhost:4444/wd/hub',
specs: ['spec.js']
}
// spec.js
describe('Protractor Demo App', function() {
it('should have a title', function() {
browser.pause();
browser.get('http://juliemr.github.io/protractor-demo/');
browser.pause();
expect(browser.getTitle()).toEqual('Super Calculator');
});
});
+1 this is happening to me in version 3.3.0. (this never used to happen, I know how to use these pause/debug features, it's specific to 3.3.0)
+1 4.0.4 happening as well
I fixed this issue in 4.0.5
https://github.com/angular/protractor/pull/3504
On Sep 28, 2016 22:16, "tommyz0123" [email protected] wrote:
+1 4.0.4 happening as well
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/angular/protractor/issues/2206#issuecomment-250303259, or mute the thread https://github.com/notifications/unsubscribe-auth/AAAlRwySpsrbPFeitr7ibMP6G53OIYfWks5qutk6gaJpZM4E4T-U .