TestCafe中是否可以验证Chrome网络调用? [英] Is there a way in TestCafe to validate Chrome network calls?

查看:146
本文介绍了TestCafe中是否可以验证Chrome网络调用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个测试用例,需要导航到一个网页并在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://devexpress.github.io/testcafe/documentation/test-api/intercepting-http-requests/ 在testCafe网站上但是我不确定这是否与保留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 对象< a href = https://devexpress.github.io/testcafe/documentation/test-api/intercepting-http-requests/logging-http-requests.html rel = nofollow noreferrer>存储所有已发送的HTTP请求和响应测试运行时收到。这与在当前测试运行期间抓住网络活动(网络标签)相同。您还可以同时使用过滤器选项调整 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网络调用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆