I am not able to create the HAR file using the code provided on your github home page. I am using Java 8 and ChromeDriver. The har file does not have entries. It has below details
HAr File
{
"log": {
"version": "1.1",
"creator": {
"name": "BrowserUp Proxy",
"version": "${project.version}"
},
"pages": [
{
"startedDateTime": "2020-07-13T12:45:02.053+00:00",
"id": "MY_HAR",
"title": "MY_HAR",
"pageTimings": {
"onContentLoad": -1,
"onLoad": -1
}
}
],
"entries": []
}
}
code snippet.
System.setProperty("webdriver.chrome.driver", "D:\\programs\\chromedriver_win32\\chromedriver.exe");
BrowserUpProxyServer proxy = new BrowserUpProxyServer();
proxy.setTrustAllServers(true);
proxy.start();
ChromeOptions options = new ChromeOptions();
options.addArguments("--ignore-certificate-errors");
options.addArguments("--headless");
// configure it as a desired capability
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability(CapabilityType.ACCEPT_SSL_CERTS, true);
capabilities.setCapability(ChromeOptions.CAPABILITY, options);
// get the Selenium proxy object
Proxy seleniumProxy = ClientUtil.createSeleniumProxy(proxy);
capabilities.setCapability(CapabilityType.PROXY, seleniumProxy);
// configure it as a desired capability
// start the browser up
ChromeDriver driver = new ChromeDriver(capabilities);
// enable more detailed HAR capture, if desired (see CaptureType for the complete list)
proxy.setHarCaptureTypes(CaptureType.getAllContentCaptureTypes());
proxy.setHarCaptureTypes(CaptureType.REQUEST_CONTENT, CaptureType.REQUEST_BINARY_CONTENT, CaptureType.REQUEST_COOKIES, CaptureType.REQUEST_HEADERS, CaptureType.RESPONSE_CONTENT, CaptureType.RESPONSE_COOKIES, CaptureType.RESPONSE_HEADERS, CaptureType.RESPONSE_BINARY_CONTENT);
//proxy.enableHarCaptureTypes(CaptureType.REQUEST_CONTENT, CaptureType.REQUEST_BINARY_CONTENT, CaptureType.REQUEST_COOKIES, CaptureType.REQUEST_HEADERS, CaptureType.RESPONSE_CONTENT, CaptureType.RESPONSE_COOKIES, CaptureType.RESPONSE_HEADERS, CaptureType.RESPONSE_BINARY_CONTENT);
// create a new HAR with the label "yahoo.com"
proxy.newHar("MY_HAR");
Har har = proxy.getHar();
// open yahoo.com
driver.get("https://www.yahoo.com");
FileOutputStream fos1 = new FileOutputStream("d:\\outputs\\1.har");
// get the HAR data
System.out.println( " proxy.getHarCaptureTypes() " + proxy.getHarCaptureTypes());
System.out.println( " Har " + har.getLog().getEntries().size() );
proxy.stop();
har.writeTo(fos1);
driver.quit();
fos1.close();
I am not able to create the HAR file using the code provided on your github home page. I am using Java 8 and ChromeDriver. The har file does not have entries. It has below details HAr File { "log": { "version": "1.1", "creator": { "name": "BrowserUp Proxy", "version": "${project.version}" }, "pages": [ { "startedDateTime": "2020-07-13T12:45:02.053+00:00", "id": "MY_HAR", "title": "MY_HAR", "pageTimings": { "onContentLoad": -1, "onLoad": -1 } } ], "entries": [] } }
code snippet.