【发布时间】:2017-08-04 08:56:42
【问题描述】:
我使用的是 selenium 2.53.0(我不想更新到 3.0,因为我需要在 Firefox 上工作,而 Selenium 没有为 FF 实现操作)。
我的问题是:我尝试以私有模式打开 FF(我不想保留缓存,因为我运行了很多 FF 实例)
为此,我使用 FF 配置文件并且我有证书,所以我接受它。
我的代码是:
FirefoxDriverManager.getInstance().setup();
capabilities.setBrowserName("firefox");
capabilities.setVersion("46");
ProfilesIni profile = new ProfilesIni();
FirefoxProfile ffProfile = profile.getProfile("default");
ffProfile.setPreference("browser.private.browsing.autostart", true);
ffProfile.setPreference("browser.privatebrowsing.autostart", true);
//accept the certificate
ffProfile.setAcceptUntrustedCertificates(true);
ffProfile.setAssumeUntrustedCertificateIssuer(false);
capabilities.setCapability(FirefoxDriver.PROFILE, ffProfile);
WebDriver webDriver = new FirefoxDriver();
我尝试了"browser.private.browsing.autostart" 和"browser.privatebrowsing.autostart",因为当我在firefox 中执行about:config 时,我发现了这两个。
我没有收到任何错误,Firefox 运行我的测试,但不是私下运行。你有什么主意吗? 我找到了这个post,但它没有答案。
【问题讨论】: