我正在使用代理排除第三方资源。但是我对所有以 https 开头的资源都有疑问。你能建议任何解决方案吗?例如,我试图从http://linkedin.com中排除 static.licdn.com 。它改变状态但下载资源。
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);
}
}
- 浏览器暴民版本:2.1.1
- 硒版本:2.53
- FF版:46