Search code examples
javaselenium-webdriverproxybrowsermobbrowsermob-proxy

BrowserMob proxy doesn't blacklist https resources


I am using proxy to exclude third party resources . But I have a problem with all resources which start with https . Could you please suggest any solution ? For example I am trying to exclude static.licdn.com from http://linkedin.com . It change status but download the resource .

   public void setUp()    
    throws Exception
{
    setName("test");
    try
    {
        FirefoxBinary firefoxbinary = new FirefoxBinary(new File("firefoxpath"));
        File file = new File("profilePath");
        FirefoxProfile firefoxprofile = new FirefoxProfile(file);
        firefoxprofile.setPreference("browser.startup.homepage", "http://www.google.com");
        BrowserMobProxyServer server = new BrowserMobProxyServer();
        server.start();
        ArrayList arraylist = new ArrayList();
        arraylist.add(new BlacklistEntry(".*static\\.licdn\\.com.*", 204));
        server.setBlacklist(arraylist);
        org.openqa.selenium.Proxy proxy = ClientUtil.createSeleniumProxy(server);
        proxy.setSslProxy("localhost:" + server.getPort());
        DesiredCapabilities desiredcapabilities = new DesiredCapabilities();
        desiredcapabilities.setCapability("proxy", proxy);
        desiredcapabilities.setCapability("acceptSslCerts", true);
        driver = new FirefoxDriver(firefoxbinary, firefoxprofile, desiredcapabilities);
    }
    catch(Throwable throwable)
    {
        LOG.error("Problem in setup: ", throwable);
    }
}
  • browser mob version : 2.1.1
  • selenium version : 2.53
  • FF version : 46

Solution

  • The solution - we just write our custom plugin for exluding third party libs . Unfortunatly I cant share my codes due to project policy .