Mitchell Hentges
Mitchell Hentges

Reputation: 127

Viewing outstanding requests

Is there any way to view what requests Protractor are waiting on? I'm trying to debug flaky state testing, but it is hard to tell whether a button didn't trigger a response or if Protractor didn't bother to wait.

TL;DR: How can I view the remaining promises on the Protractor control flow?

Upvotes: 1

Views: 528

Answers (1)

alecxe
alecxe

Reputation: 473823

The usual approach is to start protractor in a debug mode and put browser.debugger() breakpoint before the problem block of code.

See more information at Debugging Protractor Tests.


On the other hand, you can catch the chromedriver service logs that look like:

[2.389][INFO]: COMMAND FindElement {
   "sessionId": "b6707ee92a3261e1dc33a53514490663",
   "using": "css selector",
   "value": "input"
}
[2.389][INFO]: Waiting for pending navigations...
[2.389][INFO]: Done waiting for pending navigations
[2.398][INFO]: Waiting for pending navigations...
[2.398][INFO]: Done waiting for pending navigations
[2.398][INFO]: RESPONSE FindElement {
   "ELEMENT": "0.3367185448296368-1"
}

Might also give you a clue of what is happening.

For this, you need to start chrome with --verbose and --log-path arguments:

{
     browserName: "chrome",
     specs: [
         "*.spec.js"
     ],
     chromeOptions: {
         args: [
             "--verbose",
             "--log-path=/path/to/the/log/file"
         ]
     }
 }

(not tested)

For firefox, you can turn on and view logs by setting webdriver.log.driver and webdriver.log.file firefox profile settings.

See also:

Upvotes: 1

Related Questions