查看未完成请求未完成

2023-09-13 03:57:16 作者:若没人陪你颠沛流离

请问有什么办法可以查看哪些请求量角器在等待?我试图调试片状国家检测,但很难讲一个按钮是否没有触发响应或者量角器没有刻意去等待。

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:我如何才能查看到量角器控制流剩下的承诺

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

推荐答案

通常的做法是在调试模式下启动量角器的放的 browser.debugger() 断点前问题块code的。

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

参见调试量角器测试。

在另一方面,你可以赶上的 chromedriver服务日志的看起来像:

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"
         ]
     }
 }

(未测试)

对于Firefox,您可以通过设置查看日志 webdriver.log.driver 和 webdriver.log.file Firefox的配置设置。

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

另请参阅:

监控JSON线协议日志 如何更改Firefox配置文件 Monitoring JSON wire protocol logs How to change firefox profile
 
精彩推荐