问题描述
我有一个测试用例,我需要导航到网页并在 chrome 浏览器中验证该页面的网络调用.理想情况下,我会将它们放入一个变量中,并为某些与分析相关的调用过滤它们并验证它们的值.
I have a test case where I need to navigate to a webPage and validate the network calls in chrome browser for that page. Ideally, I would take them in a variable and filter them for certain analytics related calls and validate their values.
这可以通过 Selenium 中的 chrome 功能来完成.请参阅此处的文档:http://chromedriver.chromium.org/logging/performance-log 但我想通过 testCafe 来做到这一点?
This can be done through chrome capabilities in Selenium. See doc here: http://chromedriver.chromium.org/logging/performance-log but I am trying to do this through testCafe?
我遇到了这个文档:https://testCafe 网站上的 devexpress.github.io/testcafe/documentation/test-api/intercepting-http-requests/ 但我不确定这是否与在 chrome 中获取性能日志相同.基本上,如果我能够在 chrome 中的开发人员工具下的网络选项卡中获取所有调用,我应该能够使用 JavaScript 对其进行过滤并完成我的测试.
I came across this documentation: https://devexpress.github.io/testcafe/documentation/test-api/intercepting-http-requests/ on testCafe site but I am not sure if this is same as getting hold of performance logs in chrome. Basically, if I am able to grab hold of all the calls in the network tab under developer tools in chrome, I should be able to filter it using JavaScript and complete my testing.
与此相关的任何输入都会有所帮助.谢谢
Any inputs related to this would be helpful. Thanks
推荐答案
是的,都是一样的:RequestLogger
对象存储测试运行期间发送的所有 HTTP 请求和接收的响应.这与在当前测试运行期间抓住您的网络活动(网络"标签)相同.您还可以使用 filter
和 options
参数调整您的 Logger
.
Yes, it is the same: the RequestLogger
object stores all HTTP requests sent and responses received while the test is running. It's the same as grabbing hold of your network activity (the "Network" tab) during the current test run. You can also tune your Logger
using both filter
and options
parameters.
这篇关于TestCafe 有没有办法验证 Chrome 网络调用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!