firefox native extension -- har export trigger

这两天想学习下如何在运行自动化脚本时去capture http traffic,google看到一篇博客介绍用browser mob proxy或者firefox+firebug+netexport,后来去netexport的github官网发现已经不维护了,你能够去到http://getfirebug.com/releases/netexport/ 下载最新版的netexport,可是安装的时候会提示你unverified add-ons,没法安装,参考http://winaero.com/blog/enable-unsigned-add-ons-disabled-by-firefox-43/,听说能够解决这个问题。可是在个人mac firefox53版本上并无解决, 查看这篇博客 https://support.mozilla.org/en-US/questions/1101877 得知firefox 44之后就不能按照以前连接上说的作啦,须要sign in add-on in firefox https://support.mozilla.org/en-US/kb/add-on-signing-in-firefox,放弃,太繁琐了,这原本就是人气不维护的库了,并且之后firebug没人维护,早晚都会出问题。html

http://www.softwareishard.com/blog/har-export-trigger/ 这是它的替代品har export trigger,  firefox 开发工具源生的插件,功能与net export同样,做者都是同一个。git

尝试了下coding,github

require 'selenium-webdriver'

profile = Selenium::WebDriver::Firefox::Profile.new
profile.add_extension '/Users/Tim/Library/Application Support/Firefox/Profiles/09kanu7u.watir/extensions/harexporttrigger@getfirebug.com.xpi'
profile["extensions.netmonitor.har.enableAutomation"] = true
profile["extensions.netmonitor.har.contentAPIToken"] = 'test'
profile["extensions.netmonitor.har.autoConnect"] = true
profile['devtools.netmonitor.har.enableAutoExportToFile'] = true
options = Selenium::WebDriver::Firefox::Options.new
options.profile = profile

b = Selenium::WebDriver.for :firefox, options: options
b.navigate.to "http://janodvarko.cz/har/tests/har-export-trigger/har-export-api.html"

b.close if b

 

发如今浏览器的profile目录下的/har/log并无生成har文件,google后发现使用者忽略不计,而后还碰巧遇到一个童鞋遇到同样的问题,发如今selenium3.0上不支持,我猜想是由于firefox48 以上之后用的geckodriver,这个driver没记错的话是16年出来的,web

而这2个firefox的插件都是15年就出来了,并且发现har export trigger也已经2年没更新维护了,估计不行,若是执着的童鞋能够降selenium版本到2.xx版本,firefox版本小于48试试api

相关文章
相关标签/搜索