【发布时间】:2019-12-03 12:25:57
【问题描述】:
我想在我的 ASP.NET Core 2.1 Web 应用程序上运行一些自动浏览器测试。对于这个应用程序,我启用了 HttpsRedirection,并运行命令 dotnet dev-certs https --trust 以信任 ASP.NET Core 使用的 ssl 证书。
我已经下载了 firefox selenium 驱动程序并将可执行文件添加到我的 PATH 中。当我运行代码时,这会打开一个 firefox 窗口。
接受风险并继续没有任何作用,因为代码已经与浏览器断开连接。
var firefoxOptions = new FirefoxOptions();
var profile = new FirefoxProfile();
profile.AcceptUntrustedCertificates = true;
// Tried the following, got this: Invalid moz:firefoxOptions field acceptInsecureCerts
// firefoxOptions.AddAdditionalCapability(CapabilityType.AcceptInsecureCertificates, true);
firefoxOptions.Profile = profile;
var driver = new FirefoxDriver(firefoxOptions);
driver.Url = "http://localhost:5002/";
我希望被带到我的网络应用程序,就像我自己在 Firefox 中浏览到 http://localhost:5002 时一样。相反,我得到以下信息:
【问题讨论】:
标签: c# ssl selenium-webdriver selenium-firefoxdriver