您的连接不安全 - 使用 Selenium.WebDriver v.3.6.0 + Firefox v.56

Your connection is not secure - using Selenium.WebDriver v.3.6.0 + Firefox v.56(您的连接不安全 - 使用 Selenium.WebDriver v.3.6.0 + Firefox v.56)

本文介绍了您的连接不安全 - 使用 Selenium.WebDriver v.3.6.0 + Firefox v.56的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 Selenium + C# 编写测试,但我面临一个重要问题,因为我在使用安全连接 (HTTPS) 测试我的网站时没有找到解决方案.我在 stackoverflow 上找到的所有解决方案都已过时或不起作用.我试图从以下问题中练习所有解决方案:Selenium 为什么为 firefox 驱动程序设置 acceptuntrustedcertificates 为 true 不工作吗?

I'm writing tests with Selenium + C# and I face an important issue because I didn't found 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 tried to exercise all solutions from below question: Selenium Why setting acceptuntrustedcertificates to true for firefox driver doesn't work?

但他们并没有帮我解决问题也不是使用 Nightly FireFox 的解决方案.不过,当 selenium 加载 Firfox 浏览器时,我看到页面:您的连接不安全".

But they did not help me solve the problem Nor is it the solution of using Nightly FireFox. Still, when the selenium loading Firfox browser, I see the page: "Your connection is not secure".

配置:

  • 火狐 v56.0
  • Selenium.Firefox.WebDriver v0.19.0
  • Selenium.WebDriver v3.6.0
  • Firefox v56.0
  • Selenium.Firefox.WebDriver v0.19.0
  • Selenium.WebDriver v3.6.0

我的代码是:

                    FirefoxOptions options = new FirefoxOptions();
                    FirefoxProfile profile = new FirefoxProfile();
                    profile.AcceptUntrustedCertificates = true;
                    profile.AssumeUntrustedCertificateIssuer = false;
                    options.Profile = profile;
                    driver = new FirefoxDriver(FirefoxDriverService.CreateDefaultService() , options , TimeSpan.FromSeconds(5));
                    Drivers.Add(Browsers.Firefox.ToString() , driver);

感谢您的帮助!

在这里更新我的问题:

注意 1:致将我的问题标记为该问题重复的任何人:

Note 1: To anyone who has marked my question as a duplicate of this question:

Firefox selenium webdriver 提供不安全的连接"我认为这是同样的问题,但我需要 C# 的解决方案,我尝试将您的 JAVA 代码与我上面的代码匹配

Firefox selenium webdriver gives "Insecure Connection" I thought that it is same issue, but I need solution for C#, I try match your JAVA code to my above code

首先,我将以下语句更改为 TRUE:

First, I changed to TRUE the below statment:

     profile.AssumeUntrustedCertificateIssuer = true;

其次,我创建新的 FF 配置文件(AutomationTestsProfile")并尝试使用它:

second, I create new FF profile ("AutomationTestsProfile") and try to use it:

尝试1:

       FirefoxProfile profile = new FirefoxProfileManager().GetProfile("AutomationTestsProfile");

尝试 2:

       FirefoxProfile profile = new FirefoxProfile("AutomationTestsProfile");

我运行 2 个选项,但问题仍然存在.

I Run 2 options, but still the issue exists.

注意 2:我附上了我的问题的屏幕截图,当驱动程序尝试在登录页面上输入文本到用户名时出现.

Note 2: I attached screenshot of my problem, it appears when the driver try to enter text to user-name on login page.

我注意到当我用 FF 打开我的网站时,Firefox 在地址栏中显示一个带有红色删除线的锁定图标 红色删除线图标,

I noticed that when I open my site with FF, Firefox displays a lock icon with red strike-through red strikethrough icon in the address bar,

但在用户名文本框附近没有出现味精:

but near the username textbox not appears the msg:

此连接不安全.此处输入的登录信息可能会被盗用.了解更多"(正如您在重复问题中所写的那样),

"This connection is not secure. Logins entered here could be compromised. Learn More" (as you writed on the duplicate question),

那么也许有不同的问题?

推荐答案

您正在设置配置文件的属性.FirefoxOptions 有一个属性 AcceptInsecureCertificates,将其设置为 true.

You are setting the properties on the profile. The FirefoxOptions has a property AcceptInsecureCertificates, set that to true.

忘记个人资料,这就是你想要的:

Forget the profile, this is what you want:

var op = new FirefoxOptions
{
    AcceptInsecureCertificates = true
};

Instance = new FirefoxDriver(op);

这篇关于您的连接不安全 - 使用 Selenium.WebDriver v.3.6.0 + Firefox v.56的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本文标题为:您的连接不安全 - 使用 Selenium.WebDriver v.3.6.0 + Firefox v.56

基础教程推荐