1
我寫過一個從firefox瀏覽器獲取har數據的類。以json和字符串格式獲取Har數據
我想獲取JSON格式的har數據以正確顯示。
我的代碼:
ProxyServer server = new ProxyServer(4444);
server.start();
//captures the moouse movements and navigations
server.setCaptureHeaders(true);
server.setCaptureContent(true);
// get the Selenium proxy object
Proxy proxy = server.seleniumProxy();
// configure it as a desired capability
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability(CapabilityType.PROXY, proxy);
// start the browser up
WebDriver driver = new FirefoxDriver(capabilities);
// create a new HAR with the label "apple.com"
server.newHar("yahoo.com");
// open yahoo.com
driver.get("http://yahoo.com");
// get the HAR data
net.lightbody.bmp.core.har.Har har = server.getHar();
五月任何人幫助我得到的JSON格式字符串太HAR數據!