本文介绍了使自动化HAR文件代从谷歌浏览器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

基本上我需要的是使自动化的的结果的方法的下列操作:

Basically what I need is a way to automatize the result of the following operations:


  1. 打开一个新标签;

  1. open a new tab;

打开开发工具网络选项卡;

open the Network tab in the developer tools;

加载一个URL;

选择保存所有为HAR。

select "Save All as HAR".

通常情况下,提出的解决方案包括使用,的或;因为我需要交通工作的那些不适合我的情况。

Often, proposed solutions involves the use of PhantomJS, browsermob-proxy, or pcap2har; those won't fit my case since I need to work with SPDY traffic.

我试图潜入而事实上我设法使自动化某些任务,但仍没有运气什么涉及HAR文件生成。现在是特别有希望的,但我还是想不通怎么会我用它。

I tried to dive into the Google Chrome Extensions API and indeed I managed to automatize some tasks, but still no luck for what concerns the HAR files generation. Now this method is particularly promising but I still can't figure out how would I use it.

在换句话说,我需要像 的。请注意以下几点:

In other words, I need something like this experiment from the Google guys. Note the following:

我们使用Chrome的。这也给了我机会,深入了解了并写了一个较低Node.js的级别接口,用于通用型镀铬自动化:的。

The short answer is, there is no way to get at the data you are after directly. The getHAR method is only applicable to extensions meant to extend DevTools itself. The good news is, you can construct the HAR file yourself without too much trouble - this is exactly what phantom.js does.


  1. Chrome启动远程调试

  2. 连接到Chrome浏览器与WebSocket连接调试端口

  3. 启用网络的调试,还可以清除缓存,等等 - 见。

  4. 告诉浏览器导航到你想要捕捉的页面,Chrome将传输所有请求的元数据还给你。

  5. 按摩网络数据转换成HAR格式,ALA phantom.js

  6. ...

  7. 利润。

有关一个良好的开端,我有一个帖子说样品红宝石code应该您开始使用步骤1-4:http://www.igvita.com/2012/04/09/driving-google-chrome-via-websocket-api/

For a head start, I have a post that with sample Ruby code that should you get started with steps 1-4: http://www.igvita.com/2012/04/09/driving-google-chrome-via-websocket-api/

这篇关于使自动化HAR文件代从谷歌浏览器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-27 02:13