3

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
nairavs
  • 437
  • 1
  • 6
  • 19
  • 1
    What is the problem you're seeing? You say you see the status code, but the proxy still fetches the resource, but it's not possible for BMP to do that if an entry is blacklisted. Also: where is the Firefox instance running? It's generally not necessary to call .setSslProxy() explicitly if you're using .createSeleniumProxy(), but you're explicitly setting it to "localhost" which means Firefox has to be running on the same machine as BMP. – Jason Hoetger Jul 10 '16 at 01:28
  • The problem is related to https resources . If recourse is https , it will not be excluded – nairavs Jul 11 '16 at 07:48
  • I have reproduced this problem with a different host, but borrowed yours to file a bug report: https://github.com/lightbody/browsermob-proxy/issues/509 – jordanpg Jul 21 '16 at 21:06

1 Answers1

-1

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

nairavs
  • 437
  • 1
  • 6
  • 19