But everytime I run it the har file shows that BrowserMob is sending cookies to the server.
public static void doChrome(){
ProxyServer chromeProxyServer = new ProxyServer(4456);
Proxy chromeProxy = null;
RemoteWebDriver chromeWebDriver;
try {
chromeProxyServer.start();
} catch (Exception e) {
System.out.println("Proxy Server Failed...");
}
chromeProxyServer.setCaptureContent(true);
chromeProxyServer.setCaptureHeaders(true);
try {
chromeProxy = chromeProxyServer.seleniumProxy();
} catch (Exception e){
System.out.println("BLAH...");
}
chromeProxyServer.newHar("chrome");
/*Chrome*/
DesiredCapabilities dcChrome = DesiredCapabilities.chrome();
dcChrome.setCapability(CapabilityType.ACCEPT_SSL_CERTS, true);
dcChrome.setCapability(CapabilityType.PLATFORM, "MAC");
//This should disable cookies with the Chrome Browser
Map<String, Integer> prefs = new Hashtable<String, Integer>();
prefs.put("profile.managed_default_content_settings.cookies", 2);
dcChrome.setCapability("chrome.prefs", prefs);
dcChrome.setCapability(CapabilityType.PROXY, chromeProxy);
//chromeProxyServer.waitForNetworkTrafficToStop(500, 2000);
Har chromeHar = chromeProxyServer.getHar();
String chromeFilePath = "/Users/irh/projects/HARfiles/chrome.har";
try {
FileOutputStream chromeFOS = new FileOutputStream(chromeFilePath);
chromeHar.writeTo(chromeFOS);
} catch (Exception e) {
System.out.println("Writing the har file failed...");
}
try {
chromeProxyServer.stop();
} catch (Exception e) {
System.out.println("I refuse to stop...");
}
chromeWebDriver.quit();
}