8

I am setting up a ChromeDriver using BrowserMob(http://bmp.lightbody.net/) for intercepting HTTP responses.

ProxyServer proxyServer = null;
proxyServer = new ProxyServer(9101);
proxyServer.start();

proxyServer.setCaptureContent(true);
proxyServer.setCaptureHeaders(true);

Proxy proxy = proxyServer.seleniumProxy();
proxy.setHttpProxy("localhost:9101");


proxyServer.addResponseInterceptor(new ResponseInterceptor() {

@Override
public void process(BrowserMobHttpResponse response, Har har) {
    if (response.getRawResponse().getStatusLine().getStatusCode() == 500) {
                    // do something
                }

            }
        });

DesiredCapabilities capabilities = DesiredCapabilities.chrome();
capabilities.setCapability(CapabilityType.PROXY, proxy);

System.setProperty("webdriver.chrome.driver", "seleniumdrivers/chromedriver.exe");
ChromeOptions options = new ChromeOptions();
options.addArguments("--lang=nl");
capabilities.setCapability(ChromeOptions.CAPABILITY, options);
this.driver = new ChromeDriver(capabilities);

When running a Selenium test every page load is extremely slow. Without the proxy it works fine. Anyone knows the reason/ solution for this?

In the log console the following message appears: jan 10, 2014 12:58:06 PM net.sf.uadetector.datastore.AbstractUpdateOperation isUpdateAvailable INFO: Can not check for an updated version. Are you sure you have an established internet connection? No idea if this is related. Running Selenium tests on an online website (not local server), which means I have internet connection

ddavison
  • 25,442
  • 12
  • 70
  • 96
Charlie
  • 491
  • 1
  • 4
  • 16
  • 1
    Could be related to issue [BrowserMob Proxy extremely slow when recording HAR file](https://github.com/webmetrics/browsermob-proxy/issues/66). Can you confirm if it's getting stuck on accessing `UserAgentInfo`? – Faiz Jan 14 '14 at 02:45
  • thanks, while digging into it I noticed it is a network issue. The browser is stuck on calling http://code.jquery.com/ (which is declared as script in html) and returns a timeout when using browsermob. I am connected to an office network with specific proxy settings. The webapplication I am testing is hosted somewhere inside the office network. Apparently I can't access any online website with the browsermob proxy – Charlie Jan 14 '14 at 10:32
  • @Charlie, Did you find the solution is for it? I am also stuck with the same problem..I am not able to access any website with browsermob proxy – javanoob Nov 09 '14 at 07:27
  • @javanoob no actually I didn't find a solution for this – Charlie Nov 11 '14 at 14:42

0 Answers0