我正在使用Selenium + C#编写测试,但我面临一个重要问题,因为我在使用安全连接 ( HTTPS )测试我的网站时没有找到解决方案。我在 stackoverflow 上找到的所有解决方案都已过时或不起作用。我尝试使用以下问题中的所有解决方案: Selenium 为什么将 Firefox 驱动程序的 acceptuntrustedcertificates 设置为 true 不起作用?
但是他们没有帮我解决问题也不是使用Nightly FireFox的解决方案。尽管如此,当 selenium 加载 Firfox 浏览器时,我看到页面:“您的连接不安全”。
配置:
我的代码是:
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);
Run Code Online (Sandbox Code Playgroud)
感谢您的帮助!
更新我的问题在这里:
注 1:致任何将我的问题标记为与此问题重复的人:
Firefox selenium webdriver 给出了“不安全的连接” 我认为这是同样的问题,但我需要 C# 的解决方案,我尝试将您的 JAVA 代码与我上面的代码相匹配
首先,我将以下语句改为 TRUE:
profile.AssumeUntrustedCertificateIssuer = …Run Code Online (Sandbox Code Playgroud)