【发布时间】:2020-09-25 05:48:47
【问题描述】:
我需要将站点 URL 添加到允许不安全内容的站点列表中。我终其一生都找不到关于这个主题的任何东西。我能够执行类似的操作来添加 URL 列表以允许 Flash,但无法让 Chrome 特定的设置语法适用于不安全的内容选项卡。这是我用来获取允许的 Flash 设置的 URL 列表的代码:
var service = ChromeDriverService.CreateDefaultService(seleniumLocation);
var options = new ChromeOptions();
List<string> flashUrls = new List<string>() {
"https://www.someplace.com","https://www.someotherplace.com" };
options.AddUserProfilePreference("profile.managed_plugins_allowed_for_urls", flashUrls);
IWebDriver driver = new ChromeDriver(service, options);
效果很好。我已经为不安全的内容尝试了不同的变体,但没有一个能够添加 URL。
List<string> insecureUrls = new List<string>() {
"https://www.someplace.com","https://www.someotherplace.com" };
options.AddUserProfilePreference("profile.insecure_content_allowed_for_urls", insecureUrls);
我很确定 profile.insecure_content_allowed_for_urls 部分出了什么问题,但在任何地方都找不到关于它应该是什么的任何信息。下面是 Chrome 中设置的截图。
【问题讨论】:
标签: c# selenium selenium-chromedriver