TestCafe 有没有办法验证 Chrome 网络调用?

Is there a way in TestCafe to validate Chrome network calls?(TestCafe 有没有办法验证 Chrome 网络调用?)
本文介绍了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://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 请求和接收的响应.这与在当前测试运行期间抓住您的网络活动(网络"标签)相同.您还可以使用 filteroptions 参数调整您的 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 thecurrent test run. You can also tune yourLoggerusing bothfilterandoptionsparameters.

这篇关于TestCafe 有没有办法验证 Chrome 网络调用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

相关文档推荐

SCRIPT5: Access is denied in IE9 on xmlhttprequest(SCRIPT5:在 IE9 中对 xmlhttprequest 的访问被拒绝)
XMLHttpRequest module not defined/found(XMLHttpRequest 模块未定义/未找到)
Show a progress bar for downloading files using XHR2/AJAX(显示使用 XHR2/AJAX 下载文件的进度条)
How can I open a JSON file in JavaScript without jQuery?(如何在没有 jQuery 的情况下在 JavaScript 中打开 JSON 文件?)
quot;Origin null is not allowed by Access-Control-Allow-Originquot; in Chrome. Why?(“Access-Control-Allow-Origin 不允许 Origin null在铬.为什么?)
How to get response url in XMLHttpRequest?(如何在 XMLHttpRequest 中获取响应 url?)