关于HTTP所有的信息的一种文件保存格式
获取:
1.F12 右键 Save as HAR with Content
2.compile ‘net.lightbody.bmp:browsermob-core-littleproxy:2.1.0-beta-4‘ compile ‘org.seleniumhq.selenium:selenium-java:2.49.0‘
BrowserMobProxy proxy = new BrowserMobProxyServer();
proxy.start();
Proxy seleniumProxy = ClientUtil.createSeleniumProxy(proxy);
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability(CapabilityType.PROXY, seleniumProxy);
WebDriver driver = new FirefoxDriver(capabilities);
proxy.newHar("http://www.baidu.com");
driver.get("http://www.baidu.com");
Har har = proxy.getHar();
har.writeTo(new File("baidu.com.har"));
driver.close();
时间: 2024-10-29 03:20:12