硒为什么为firefox驱动程序设置acceptuntrustedcertificates为true不起作用? [英] Selenium Why setting acceptuntrustedcertificates to true for firefox driver doesn't work?

查看:133
本文介绍了硒为什么为firefox驱动程序设置acceptuntrustedcertificates为true不起作用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一些硒测试,我面临一个重要的问题,因为当我使用安全连接( HTTPS )测试我的网站时,我没有找到真正的解决方案。我在stackoverflow上找到的所有解决方案已过时或不起作用:



  1. 如何使用Selenium禁用Firefox的不可信连接警告?
  2. 使用WebDriver处理UntrustedSSL证书

我唯一的解决方法是使用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!

    感谢您的帮助!
    <解决方案

是的,这是一个geckodriver的bug。你可以在这里找到它!


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:

  1. I am writing a Selenium script in Firefox but I am getting "Untrusted Certificate"
  2. How to disable Firefox's untrusted connection warning using Selenium?
  3. 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆