我正在开发一些Selenium测试,但遇到了一个重要问题,因为当我使用安全连接(HTTPS)测试我的网站时,我没有找到一个“真正”的解决方案。我在stackoverflow上找到的所有解决方案都已过时或无法使用:
我唯一的解决办法是使用Github上指定的夜间版Mozilla版本:https://github.com/mozilla/geckodriver/issues/420
private IWebDriver driver;
private string baseURL;
private FirefoxOptions ffOptions;
private IWait<IWebDriver> wait;
[SetUp]
public void SetupTest()
{
ffOptions = new FirefoxOptions();
ffOptions.BrowserExecutableLocation = @"D:\AppData\Local\Nightly\firefox.exe";
FirefoxProfile profile = new FirefoxProfile();
profile.AssumeUntrustedCertificateIssuer = false;
profile.AcceptUntrustedCertificates = true;
ffOptions.Profile = profile;
ffOptions.LogLevel = FirefoxDriverLogLevel.Info;
driver = new FirefoxDriver(FirefoxDriverService.CreateDefaultService(), ffOptions, TimeSpan.FromSeconds(30));
//[...]
}
配置:
- Firefox v47.0.1、v49.0.2、v51.0.1、v52.0b9 (我尝试了这些不同版本)
- geckodriver 0.14
- selenium 3.1.0
有没有什么解决方法可以避免使用夜间发布版?
提示信息:由于我的网络策略,我只能访问stackoverflow和github,请不要建议我使用chrome!
感谢您的帮助!