0

I recently upgraded my Chrome/Chromedriver from v69 to the latest v76, and my suite of Selenium tests - which use BrowserMob Proxy to inject HTTP headers - have stopped working. The ChromeDriver will open the browser OK, but the headers are no longer being injected.

Chrome, Selenium and BrowserMob Proxy are now all on the latest versions:

  1. Chrome: 76.0.3809.132
  2. BrowserMob: 2.1.5
  3. Selenium: 3.141.59

Does anyone know whether there are compatibility issues with the latest Chrome and BrowserMob? Or, can anyone spot an issue in my code?

Any help is much appreciated!

Here is my code:

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;
kelseyde
  • 1
  • 1
  • How do you know it that it does not inject headers? Is there a possibility that they fail due to some other reason? Have you monitored the traffic to know that the requests miss some headers? – Alexey R. Oct 03 '19 at 13:53
  • @AlexeyR. When I run the application in the debugger and pause on the controller, I can see that the incoming HttpServletRequest is missing the headers. When I downgrade my Chrome and ChromeDriver versions to v69, the headers re-appear. – kelseyde Oct 07 '19 at 14:56

0 Answers0