简体   繁体   English

使用 Java 代码从浏览器读取网络流量

[英]Reading network traffic from the browser using Java code

Folks,各位,

I was looking for Java capability of reading thru the network tab.我正在寻找通过网络选项卡阅读的 Java 功能。 I had a task of hitting a URL in the browser, reading and validate some tags which are fired on page load.我的任务是在浏览器中点击一个 URL,读取并验证一些在页面加载时触发的标签。 I Know to fetch the View Source Data of the page, but not sure on getting network tab data.我知道获取页面的查看源数据,但不确定获取网络选项卡数据。

example:例子:

Opening a URL in chrome browser and watching Network tab in the developer tool, i see bunch of Get requests(tags,js etc) getting fired & need to capture this data.在 Chrome 浏览器中打开一个 URL 并在开发人员工具中查看网络选项卡,我看到一堆 Get 请求(标签、js 等)被触发并需要捕获这些数据。

I wanted to know which is the best way to achieve this and great if any code snippet is available.我想知道哪种方法是实现这一目标的最佳方法,如果有任何代码片段可用,那是最好的方法。

Cheers干杯

You can use HttpClient to work on api testing.您可以使用HttpClient进行 api 测试。 There are many tutorials to work on api testing using Java.有很多教程可以使用 Java 进行 api 测试。 For starter you can read about Apache Http client .首先,您可以阅读有关Apache Http 客户端的信息

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM