硒为什么为firefox驱动程序设置acceptuntrustedcertificates为true不起作用? [英] Selenium Why setting acceptuntrustedcertificates to true for firefox driver doesn't work?
问题描述
我唯一的解决方法是使用github : https://github.com/mozilla/geckodriver/issues/420
私人IWebDriver驱动程序;
私有字符串baseURL;
私有FirefoxOptions ffOptions;
private IWait< IWebDriver>等待;
[SetUp]
public void SetupTest()
{
ffOptions = new FirefoxOptions();
ffOptions.BrowserExecutableLocation = @D:\AppData\Local\Nightly\firefox.exe;
FirefoxProfile配置文件=新的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 b
$ b有没有人有解决方案,以避免使用夜间释放?
到stackoverflow和github由于我的互联网政策,请不要建议我使用chrome!
感谢您的帮助!
<解决方案
I'm developping some selenium tests and I face an important issue because I didn't found a "real" solution when I test my site with secure connection (HTTPS). All solutions I found on stackoverflow are out of date or doesn't work:
- I am writing a Selenium script in Firefox but I am getting "Untrusted Certificate"
- How to disable Firefox's untrusted connection warning using Selenium?
- Handling UntrustedSSLcertificates using WebDriver
The only workaround I have is to use the nightly mozilla release as indicated on github: 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));
//[...]
}
Configuration:
- Firefox v47.0.1, v49.0.2, v51.0.1, v52.0b9 (i tried these differents versions)
- geckodriver 0.14
- selenium 3.1.0
Does anyone have a solution to avoid using nightly release ?
For information I have access only to stackoverflow and github due to my internet policy, and please don't suggest me to use chrome!
Thank for your help!
Yeah, it's a bug on the geckodriver. You can find it here!
这篇关于硒为什么为firefox驱动程序设置acceptuntrustedcertificates为true不起作用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!