Viewing outstanding requests

自闭症网瘾萝莉.ら 提交于 2019-12-23 04:18:17

问题


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?


回答1:


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:

  • Monitoring JSON wire protocol logs
  • How to change firefox profile


来源:https://stackoverflow.com/questions/27626803/viewing-outstanding-requests

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!