C# Selenium Chrome Add URLs to Insecure Content



  • I need to add a site URL to the list of allowable sites for insecure content. I cannot for the life of me find anything on the subject. I was able to do something similar for adding a URL list to allow flash but can't get the Chrome specific settings syntax to work for the insecure content tab. This is the code I used to get the URL list to the allowable flash settings:

    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);
    

    That works perfectly fine. I've tried different variations of this for Insecure Content but none are able to add the URL.

    List<string> insecureUrls = new List<string>() { 
         "https://www.someplace.com","https://www.someotherplace.com" };
    options.AddUserProfilePreference("profile.insecure_content_allowed_for_urls", insecureUrls);
    

    I'm pretty certain what's wrong is the profile.insecure_content_allowed_for_urls portion but can't find any info anywhere about what it should actually be. Below is a screenshot of the setting in Chrome.



  • I figured out the answer for anyone that finds this later. managed_insecure_content_allowed_for_urls was the correct syntax.

    List<string> insecureUrls = new List<string>() {  "https://www.someplace.com" };
    options.AddUserProfilePreference("profile.managed_insecure_content_allowed_for_urls", insecureUrls);
    

Log in to reply
 

Suggested Topics