使用Cypress.io检查传出的浏览器网络呼叫 [英] Check outgoing browser network calls using Cypress.io

查看:71
本文介绍了使用Cypress.io检查传出的浏览器网络呼叫的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我们的网站上,当有人单击链接或执行某些操作时,会触发Omniture呼叫。在网络标签的Chrome DevTools中,您可以看到网络请求被触发。

On our site, we have Omniture calls that are fired when someone clicks on a link or takes some action. In Chrome DevTools in the network tab, you can see the network request being fired.

Cypress.io是否可以捕获传出的网络请求,因此我们可以检查/解析URL?与此等效的是类似用于Webdriver设置的Browsermob代理。我想使用Cypress.io告诉它单击链接,但是然后我想通过浏览器检查传出网络请求。

Is there a way for Cypress.io to capture outgoing network requests, so we can inspect/parse the URLs? The equivalent to this would be something like Browsermob proxy for webdriver set ups. I want to use Cypress.io to tell it to click the link, but then I want to check the outgoing network request by the browser.

推荐答案

我们找到了解决Omniture问题的解决方法。请求URL存储在附加到浏览器窗口对象的对象的Omniture属性中。使用cy.window(),我们可以获取window对象并访问此属性,并使用节点模块(querystring)来解析查询字符串。

We found a workaround to our Omniture problem. The request URL is stored in an Omniture property on an object attached to the browser window object. Using cy.window() we can get the window object and access this property and use a node module (querystring) to parse the query string.

我们在Cypress.io中找不到检查网络请求的任何本机方式。

We could not find any native way in Cypress.io to inspect network requests.

这篇关于使用Cypress.io检查传出的浏览器网络呼叫的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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