简体   繁体   English

使用 Selenium Java 清除网络选项卡

[英]Clear Network tab using Selenium Java

I am trying to load a page, and I am automating the process of checking for a POST request after a button is clicked.我正在尝试加载页面,并且在单击按钮后自动检查 POST 请求的过程。

In order to do this, I need to clear the Network tab of all previous entries before the button is clicked, otherwise it will not show up on the list for some reason.为此,我需要在单击按钮之前清除所有先前条目的网络选项卡,否则由于某种原因它不会显示在列表中。

Is there a way to do this via logging or some other means in Selenium Java?有没有办法通过日志记录或 Selenium Java 中的其他方式来做到这一点?

网络控制台

As far as I know, there is no way to interact with Chrome's dev tools as you intent to.据我所知,没有办法按照您的意图与 Chrome 的开发工具进行交互。 Alhough, if you are interested in obtaining/parse data from the Network tab in Chrome you can do that following their quick tutorial in their website here .不过,如果您有兴趣从 Chrome 中的“网络”选项卡获取/解析数据,您可以按照他们网站上快速教程进行操作。

I don't know what is you idea but here I leave you 2 cents.我不知道你有什么想法,但在这里我给你 2 美分。 Perhaps you could access this data and work it elsewhere instead of constant refreshing.也许您可以访问这些数据并在其他地方工作,而不是不断刷新。

Here is a similar question to yours. 是一个与您类似的问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在 python/java 中使用 Selenium 访问 Chrome 开发工具网络选项卡的请求或摘要的值? - How to access the values of Chrome's Dev tools Network tab's Request or summary using Selenium in python/java? Java Selenium:如何在测试运行期间阅读网络选项卡输出? - Java Selenium: how to read Network tab output during the test run? 尝试使用 selenium / java 关闭选项卡并切换到另一个选项卡时出错 - Error trying to close a tab and switching to the other tab using selenium / java 在使用 Java 运行一些 Selenium WebDriver 测试之前清除缓存 - Clear cache before running some Selenium WebDriver tests using Java Selenium Java 清除方法会不会清除输入字段? - Selenium Java clear method will not clear the input field? 使用 Selenium Java 在测试中途终止网络连接 - Kill network connection in the middle of the test using Selenium Java 使用 selenium webdriver java 4.0v 捕获网络流量 - Capture network traffic using selenium webdriver java 4.0v 使用 Selenium WebDriver 使用 Java 捕获 Firefox.network 日志 - Capturing Firefox network logs with Selenium WebDriver using Java 如何通过将Selenium WebDriver与Java一起在同一浏览器中打开新标签页? - How to open a new tab in the same browser by using Selenium WebDriver with Java? 使用 Selenium Web 驱动程序和 Java 切换到第一个选项卡 - Switching to First tab using Selenium Web Driver with Java
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM