0

I've recently upgraded my Chrome version from v70 to the latest, v76. As a result, I've noticed that my Selenium tests (which use BrowserMob Proxy to inject headers) have stopped working. The browser runs alright - but the headers are no longer injected on each request.

Does anyone know if BrowserMob Proxy is no longer compatible with the later versions of Chrome?

My Chrome version is 70.0.3538.77.

My BrowserMob version is 2.1.5.

Here is my proxy set-up:

private static Proxy createBrowserMobProxy() {

    Proxy seleniumProxy = null;
    try {

        String hostIp = Inet4Address.getLocalHost().getHostAddress();

        proxy.setTrustAllServers(true);
        proxy.start(0, Inet4Address.getByName(hostIp));

        proxy.addRequestFilter((request, contents, messageInfo) -> {
            headerMap.forEach((key, value) -> {
                if (key != null && value != null) {
                    request.headers().add((String) key, value);
                }
            });
            return null;  //continue regular processing...
        });

        seleniumProxy = ClientUtil.createSeleniumProxy(proxy, InetAddress.getByName(hostIp));
        seleniumProxy.setHttpProxy(hostIp + ":" + proxy.getPort());
        seleniumProxy.setSslProxy(hostIp + ":" + proxy.getPort());
        System.out.println("Created proxy on port " + proxy.getPort());

    } catch (UnknownHostException e) {
        LOG.error("unable to create BrowerMob proxy", e);
    }
    return seleniumProxy;

}

Any help is much appreciated, thank you!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.