Hi,
i am trying to capture network timing for my selenium tests. I am using selenium web driver selenium-server-2.37.0 and browsermob-proxy-2.0-beta-8. I have included all the dependency jars in my project.
If i comment out the line which is setting the proxy then it works fine. Page opens up.
Please let me know what could be going wrong here. screenshots is also attached.
@Test
public void testJava1Web() throws Exception{
try{
ProxyServer proxyserver = new ProxyServer(4444);
proxyserver.start();
Proxy proxy = proxyserver.seleniumProxy();
proxyserver.newHar("suman");
FirefoxProfile profileAutoUser = new FirefoxProfile();
profileAutoUser.setAssumeUntrustedCertificateIssuer(true);
profileAutoUser.setAcceptUntrustedCertificates(true);
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability(CapabilityType.PROXY, proxy);
capabilities.setCapability(FirefoxDriver.PROFILE, profileAutoUser);
WebDriver driver = new FirefoxDriver(capabilities);
driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
proxyserver.getHar().writeTo(new File("suman"));
proxyserver.stop();
driver.close();
}catch(Exception e){
System.out.println(e.getMessage());
e.printStackTrace();
}
}
In console
Started JUnit Test Runner (v4)
WARN 04/25 13:20:57 n.l.b.p.h.Simulated~ - Using InetSocketAddress.getHostName() rather than InetSocketAddress.getHostString(). Consider upgrading to Java 7 for faster performance!
INFO 04/25 13:20:57 n.l.b.p.j.h.HttpSer~ - Version Jetty/5.1.x
INFO 04/25 13:20:57 n.l.b.p.j.u.Contain~ - Started HttpContext[/,/]
INFO 04/25 13:20:57 n.l.b.p.j.h.SocketL~ - Started SocketListener on
0.0.0.0:4444INFO 04/25 13:20:57 n.l.b.p.j.u.Contain~ - Started net.lightbody.bmp.proxy.jetty.jetty.Server@1c247a0
WARN 04/25 13:24:16 n.l.b.p.ProxyServer - Waited 5 seconds for requests to cease before returning HAR; giving up!
INFO 04/25 13:24:16 n.l.b.p.j.h.SocketL~ - Stopped SocketListener on
0.0.0.0:4444INFO 04/25 13:24:16 n.l.b.p.j.u.Contain~ - Stopped HttpContext[/,/]
INFO 04/25 13:24:16 n.l.b.p.j.u.Contain~ - Stopped net.lightbody.bmp.proxy.jetty.jetty.Server@1c247a0
Process exited with exit code 1.