Reputation: 85
I'm having trouble making Protractor's browser.pause()
work. It pauses but it doesn't show the context. Is there any known issue about this?
The terminal output is just this:
$ protractor conf.js
[10:05:23] I/launcher - Running 1 instances of WebDriver
[10:05:23] I/hosted - Using the selenium server at http://localhost:4444/wd/hub
Started
[10:05:27] I/protractor -
[10:05:27] I/protractor - Encountered browser.pause(). Attaching debugger...
[10:05:27] I/protractor -
[10:05:27] I/protractor - ------- WebDriver Debugger -------
[10:05:27] I/protractor - Starting WebDriver debugger in a child process. Pause is still beta, please report issues at github.com/angular/protractor
[10:05:27] I/protractor -
[10:05:27] I/protractor - press c to continue to the next webdriver command
[10:05:27] I/protractor - press ^D to detach debugger and resume code execution
[10:05:27] I/protractor -
Starting debugger agent.
Debugger listening on [::]:5858
>>>
According to some images on internet it should show some more lines, the first one being "ControlFlow::", then like a trace up to the code snippet where it paused.
If I remove the pause it passes the test OK.
I'm using the simple example on the protractor tutorial (http://www.protractortest.org/#/tutorial) (adding just one line: browser.pause();
):
// spec.js
describe('Protractor Demo App', function() {
it('should have a title', function() {
browser.get('http://juliemr.github.io/protractor-demo/');
browser.pause();
expect(browser.getTitle()).toEqual('Super Calculator');
});
});
I tried in macOS Sierra and Ubuntu, and in both the situation is exactly the same. On macOS I tried with Chrome, Firefox and Safari (with the capabilities config attribute).
Versions:
Protractor version 5.1.1. Chrome (version 56.0.2924.87, 64-bit). Firefox (52.0) Safari (10.0.3)
With Firefox the same happens when pausing (at the beginning of the test), and without pause it doesn't pass the test, it says the page doesn't have Angular (but it does):
[09:44:56] E/protractor - Could not find Angular on page http://juliemr.github.io/protractor-demo/ : retries looking for angular exceeded
With Safari it doesn't even connect (with or without the pause):
[09:40:00] I/launcher - Running 1 instances of WebDriver
[09:40:00] I/hosted - Using the selenium server at http://localhost:4444/wd/hub
[09:40:22] E/launcher - Connection refused
[09:40:22] E/launcher - WebDriverError: Connection refused
Any suggestion is welcome. Thanks in advance.
Upvotes: 2
Views: 2858
Reputation: 85
I finally found a way to run a repl. When browser.pause pauses, there's a repl
command, but it doesn't work anymore:
Error: using repl from browser.pause() has been removed. Please use browser.enterRepl instead.
So following that message I change browser.pause();
with browser.enterRepl();
and then it stopped and gave me the context.
And there's another alias for enterRepl: browser.explore();
Hope it helps anyone having the same issue.
Upvotes: 3
Reputation: 31
I was able to solve the wait by browser.sleep(5000) Use - browser.sleep()
Upvotes: 3