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

4
  • 1
    Could be related to issue BrowserMob Proxy extremely slow when recording HAR file. Can you confirm if it's getting stuck on accessing UserAgentInfo? Commented Jan 14, 2014 at 2:45
  • thanks, while digging into it I noticed it is a network issue. The browser is stuck on calling 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 Commented Jan 14, 2014 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 Commented Nov 9, 2014 at 7:27
  • @javanoob no actually I didn't find a solution for this Commented Nov 11, 2014 at 14:42

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.