Unable to generate the har

98 views
Skip to first unread message

Kennedy Kumar

unread,
Jun 14, 2017, 6:32:52 PM6/14/17
to BrowserMob Proxy
Hi 

I'm trying to get the har from the selenium runs. 
when I pass the "Proxy seleniumProxy = ClientUtil.createSeleniumProxy(proxy);" to capabilities, I get the attached screenshot
ERR_PROXY_CONNECTION_FAILED

If I remove the proxy , I can see the test invoking the URL. 
I'm new to using BrowserMob Proxy. Any help would be appreciated.

THanks
Screen Shot 2017-06-14 at 3.30.40 PM.png

Kennedy Kumar

unread,
Jun 14, 2017, 6:33:49 PM6/14/17
to BrowserMob Proxy
=====
     BrowserMobProxy proxy = new BrowserMobProxyServer();
proxy.start(9095);

// get the Selenium proxy object
Proxy seleniumProxy = ClientUtil.createSeleniumProxy(proxy);
// seleniumProxy.setHttpProxy("localhost:"+ proxy.getPort());
// seleniumProxy.setSslProxy("localhost:"+ proxy.getPort());

// configure it as a desired capability
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability(CapabilityType.PROXY, seleniumProxy);

// start the browser up
System.setProperty("webdriver.chrome.driver", "/Users/212570773/Downloads/chromedriver");
WebDriver driver = new ChromeDriver(capabilities);

// enable more detailed HAR capture, if desired (see CaptureType for the complete list)
proxy.enableHarCaptureTypes(CaptureType.REQUEST_CONTENT, CaptureType.RESPONSE_CONTENT);

// create a new HAR with the label "yahoo.com"
proxy.newHar("yahoo.com");

// open yahoo.com
driver.get("http://yahoo.com");

// get the HAR data
Har har = proxy.getHar();
File harFile = new File("/Users/212570773/Downloads/ken.har");
har.writeTo(harFile);

// driver.quit();
===== 

Kennedy Kumar

unread,
Jun 15, 2017, 10:43:59 AM6/15/17
to BrowserMob Proxy


On Wednesday, June 14, 2017 at 3:32:52 PM UTC-7, Kennedy Kumar wrote:
===


The reason the har is not generated is because, we have another proxy to connect to Internet (set as pac) and it may not be possible with that

linda xu

unread,
Mar 18, 2021, 5:18:49 AM3/18/21
to BrowserMob Proxy
I met the same error when using BrowserMobProxy. Could u share how to solve this problem ?  Many thanks! 
Reply all
Reply to author
Forward
0 new messages