C# 处理;“不受信任的连接”;在FireFox中使用WebDriver
我遇到了ff测试的问题,当它试图打开https页面时,我收到一条“不可信连接”消息,测试失败。我尝试了很多漫游,比如C# 处理;“不受信任的连接”;在FireFox中使用WebDriver,c#,firefox,testing,webdriver,C#,Firefox,Testing,Webdriver,我遇到了ff测试的问题,当它试图打开https页面时,我收到一条“不可信连接”消息,测试失败。我尝试了很多漫游,比如 FirefoxProfile profile = new FirefoxProfile(); bool AcceptUntrustedCertificates = true; DesiredCapabilities capability = DesiredCapabilities.Firefox(); capabil
FirefoxProfile profile = new FirefoxProfile();
bool AcceptUntrustedCertificates = true;
DesiredCapabilities capability = DesiredCapabilities.Firefox();
capability.SetCapability(FirefoxDriver.ProfileCapabilityName, profile);
capability.SetCapability(CapabilityType.AcceptSslCertificates, true);
Driver = new FirefoxDriver();
或者我尝试使用一个默认配置文件,其中测试站点添加了异常。
此外,我还将多门添加到了trusted
首选项>编辑>高级>加密>查看证书>
服务器
当webdriver打开浏览器时,domen处于受信任状态,但我仍然检索到一条错误消息
有人能帮我吗?当您像这样创建FirefoxDriver时,它会为会话创建一个临时配置文件。您要做的是创建一个新的配置文件,将站点和证书添加到异常列表中,并将该配置文件与ForefoxDriver一起使用 在脚本中使用以下内容
ProfilesIni allProfiles = new ProfilesIni();
System.setProperty("webdriver.firefox.profile","Selenium"); //name of your profile
String browserProfile = System.getProperty("webdriver.firefox.profile");
FirefoxProfile profile = allProfiles.getProfile(browserProfile);
profile.setAcceptUntrustedCertificates(false);
WebDriver driver = new FirefoxDriver(profile);
正如我之前所说的“我尝试使用默认配置文件,测试站点添加到异常中”,站点被添加到异常中。我想说的是,我做的和你说的一样,但没有使用新的配置文件,而是使用默认配置文件。这对我不起作用。