使用harexporttrigger导出浏览器HAR数据
发表于:2025-12-03 作者:千家信息网编辑
千家信息网最后更新 2025年12月03日,1,环境1)Firefox 45.0下载地址:http://ftp.mozilla.org/pub/firefox/releases2)harexporttrigger-0.5.0-beta.10.x
千家信息网最后更新 2025年12月03日使用harexporttrigger导出浏览器HAR数据
1,环境
1)Firefox 45.0
下载地址:http://ftp.mozilla.org/pub/firefox/releases
2)harexporttrigger-0.5.0-beta.10.xpi
下载地址:http://www.softwareishard.com/blog/har-export-trigger/
https://github.com/firebug/har-export-trigger/releases
3)selenium-java-2.53.1.jar
org.seleniumhq.selenium selenium-java 2.53.1 2,实现代码
public static String BROWSER_PATH = "C:\\Program Files\\Mozilla Firefox\\firefox.exe";public static String HAR_EXPORTTRIGGER_PATH = "D:\\firefoxxpi\\harexporttrigger-0.5.0-beta.10.xpi" ;private final static String HARDIR = "d:\\firefoxharlog";public void init() { System.setProperty("webdriver.firefox.bin", BROWSER_PATH); }private FirefoxProfile buildNetmonitorProfile() throws IOException { FirefoxProfile profile = new FirefoxProfile(); // Load extensions File harExport = new File(HAR_EXPORTTRIGGER_PATH); //adjust path as needed profile.addExtension(harExport); // Enable the automation without having a new HAR file created for every loaded page. profile.setPreference("extensions.netmonitor.har.enableAutomation", true); // Set to a token that is consequently passed into all HAR API calls to verify the user. profile.setPreference("extensions.netmonitor.har.contentAPIToken", "test"); // Set if you want to have the HAR object available without the developer toolbox being open. profile.setPreference("extensions.netmonitor.har.autoConnect", true); // Enable netmonitor profile.setPreference("devtools.netmonitor.enabled", true); // If set to true the final HAR file is zipped. This might represents great disk-space optimization especially if HTTP response bodies are included. profile.setPreference("devtools.netmonitor.har.compress", false); // Default name of the target HAR file. The default file name supports formatters profile.setPreference("devtools.netmonitor.har.defaultFileName", "Autoexport_%y%m%d_%H%M%S"); // Default log directory for generate HAR files. If empty all automatically generated HAR files are stored in /har/logs profile.setPreference("devtools.netmonitor.har.defaultLogDir", HARDIR); // If true, a new HAR file is created for every loaded page automatically. profile.setPreference("devtools.netmonitor.har.enableAutoExportToFile", true); // The result HAR file is created even if there are no HTTP requests. profile.setPreference("devtools.netmonitor.har.forceExport", true); // If set to true, HTTP response bodies are also included in the HAR file (can produce significantly bigger amount of data). profile.setPreference("devtools.netmonitor.har.includeResponseBodies", false); // If set to true the export format is HARP (support for JSONP syntax that is easily transferable cross domains) profile.setPreference("devtools.netmonitor.har.jsonp", false); // Default name of JSONP callback (used for HARP format) profile.setPreference("devtools.netmonitor.har.jsonpCallback", false); // Amount of time [ms] the auto-exporter should wait after the last finished request before exporting the HAR file. profile.setPreference("devtools.netmonitor.har.pageLoadedTimeout", "2500"); //to prevent Firefox >= 65 from automatically updating whilst under automation. //profile.setPreference("app.update.disabledForTesting", "true"); //profile.setPreference("devtools.console.stdout.content", "true"); return profile ;}public void resovle(String url) throws Exception { WebDriver driver = null; try { FirefoxProfile profile = buildNetmonitorProfile() ; driver = new FirefoxDriver(profile); //存放Har数据的路径(目录) final File harDir = new File(HARDIR); //获取当前的文件数[用于下面判断文件是否生成] final int numFiles = harDir.listFiles().length; //访问资源 driver.get(url); // 等待创建好HAR文件 for (int c=0; c<30; c++) { if (harDir.listFiles().length > numFiles) { break; } Thread.sleep(1000L); } } catch (Exception exc) { System.err.println("error --> " + exc); } if (driver != null) { driver.quit(); } }
地址
文件
数据
代码
件数
环境
目录
资源
路径
建好
生成
浏览器
浏览
数据库的安全要保护哪些东西
数据库安全各自的含义是什么
生产安全数据库录入
数据库的安全性及管理
数据库安全策略包含哪些
海淀数据库安全审计系统
建立农村房屋安全信息数据库
易用的数据库客户端支持安全管理
连接数据库失败ssl安全错误
数据库的锁怎样保障安全
福州可富网络技术有限公司
网络安全陕西
广东x86视频服务器
制作简易数据库
数据库r图
数据库外键怎么写英文
邯郸c语言软件开发定做
服务器的管理口ip地址怎么查
网络安全情报信息研判
嘉乐软件开发工作室
java手机软件开发工具
黎明杀机那个服务器玩家弱
网络技术的论文开题报告
共享网络安全宣传图片
软件开发个人接活
C 互联网软件开发工程师
网络安全综述论文参考文献
网络安全需要重新认识
网络安全的威胁都有哪些
腾讯服务器搭建mysql
超星网络技术答案
天津戴尔服务器虚拟化迁移云主机
数据库唯一索引性能测试
郭向前预后数据库
access是数据库管理吗
河北智能软件开发制作
b站数据库可以直接登录吗
管家婆设置数据库连接参数没反应
中国学术期刊全文数据库pptx
软件开发浙江省好不好找工作