@matteo.lauria This is in continuation of your previous post How to generate .HAR file for web test suite?
I have similar code but not getting any content in my HAR file. could you plz help
System.setProperty("webdriver.chrome.driver","driverpath")
BrowserMobProxy myProxy=new BrowserMobProxyServer();
myProxy.start(portNo);
Proxy seleniumProxy=new Proxy();
seleniumProxy.setHttpProxy("ClientProxy:portNo");
seleniumProxy.setSslProxy("ClientProxy:portNo");
DesiredCapabilities capability=new DesiredCapabilities();
capability.setCapability(CapabilityType.PROXY, seleniumProxy);
capability.acceptInsecureCerts();
capability.setCapability(CapabilityType.ACCEPT_SSL_CERTS, true);
capability.setCapability (CapabilityType.ACCEPT_INSECURE_CERTS, true);
EnumSet <CaptureType> captureTypes=CaptureType.getAllContentCaptureTypes();
captureTypes.addAll(CaptureType.getCookieCaptureTypes());
captureTypes.addAll(CaptureType.getHeaderCaptureTypes());
captureTypes.addAll(CaptureType.getRequestCaptureTypes());
captureTypes.addAll(CaptureType.getResponseCaptureTypes());
myProxy.setHarCaptureTypes(captureTypes);
myProxy.enableHarCaptureTypes(CaptureType.REQUEST_CONTENT);
myProxy.newHar("MyHAR");
ChromeOptions options=new ChromeOptions();
options.merge(capability);
WebDriver driver=new ChromeDriver(options);
System.out.println("Driver Capabilities===> \n" +((RemoteWebDriver)driver).getCapabilities().asMap().toString());
driver.get("google.com");
//DriverFactory.changeWebDriver(driver)
driver.manage().window().maximize();
WebElement username=driver.findElement(By.id("username"));
WebElement password=driver.findElement(By.id("password"));
WebElement login=driver.findElement(By.id("login"));
username.sendKeys("abc");
password.sendKeys("xyz");
login.click();
Thread.sleep(30000);
Har har = myProxy.getHar();
File myHARFile=new File("C:/HARFolder/googleHAR1.har");
har.writeTo(myHARFile);
System.out.println("==> HAR details has been successfully written in the file.....");
myProxy.stop()
driver.close();