如何捕获webdriver中页面发出的所有请求? Browsermob还有其他选择吗? [英] How to capture all requests made by page in webdriver? Is there any alternative to Browsermob?

查看:222
本文介绍了如何捕获webdriver中页面发出的所有请求? Browsermob还有其他选择吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Selenium2 / WebDriver来测试我的Web应用程序。所有测试都是用Java编写的,并与Maven一起运行。

I am using Selenium2/WebDriver to test my web applications. All the tests are written in Java and run with Maven.

在用webdriver打开页面的同时,我想捕获页面发出的所有请求(图像,js和css文件等)。我使用这些数据主要有两个原因

While opening a page with webdriver I'd like to capture all the requests made by page (images, js and css files, etc). I use this data mainly for two reasons


  • 检查电话中的404(以及其他错误)

  • 检查分析代码是否正常工作(检查是否正在发送正确的请求)

根据项目,我使用Firebug与Netexport或Browsermob代理。在这两种情况下,我都可以轻松获取HAR(Html ARchive)文件,解析它并提取我想要的数据。

Depending on the project I use either Firebug with Netexport or Browsermob proxy. In both cases I can easily obtain a HAR (Html ARchive) file, parse it and extract the data I want.

这是问题所在:
我不是对这些解决方案都不满意。当页面包含加载太长时间的视频时,我特别遇到获取HAR文件的问题。我正在寻找更稳定的东西。

Here's the problem: I am not happy with neither of these solutions. I have especially problems with getting HAR file when a page contains video that is being loaded too long. I am looking for something more stable.

所以,问题是:

除了Browsermob还有其他选择吗? ?我知道FiddlerCore,但它是一个.NET库,我的测试是用Java编写的。我也听说过Ajax DynaTrace,我知道有一些方法可以将它与Selenium集成,但我发现的文档是Selenium-RC而不是WebDriver。

Is there any alternative to Browsermob? I know about FiddlerCore but it's a .NET library and my tests are written in Java. I've also heard about Ajax DynaTrace and I know that there is some way to integrate it with Selenium but the documentation I found was for Selenium-RC not WebDriver.

是有没有办法将DynaTrace与WebDriver集成或使用FiddlerCore与Java?

Is there any way to integrate DynaTrace with WebDriver or use FiddlerCore with Java?

有没有其他方法可以实现我提到的目标?我正在寻找一个可以从我的代码中轻松控制的代理。将数据导出到HAR将是一个很好的加分。

Is there any other way to achieve the goals I mentioned? I am looking for a proxy that I can easily control from my code. Exporting data to HAR would be a great plus.

推荐答案

我找到了一个谷歌小组讨论的groups.google.com/forum/#!topic/webdriver/L07NvliQZRkrel =nofollow noreferrer>。这些链接看起来像是Browsermob的有前途的替代品:

I found a google groups discussion on the topic. These links look like promising alternative to Browsermob:

这篇关于如何捕获webdriver中页面发出的所有请求? Browsermob还有其他选择吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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