Hi

Chrome driver options to allow insecure content using selenium C#

  // string downloadDirectory = Path.Combine(Directory.GetCurrentDirectory(), "Downloads");

  OpenQA.Selenium.Chrome.ChromeOptions options = new OpenQA.Selenium.Chrome.ChromeOptions();

  options.AddArgument("--start-maximized");

  //options.AddArgument("--headless=new");



  // options.AddUserProfilePreference("download.default_directory", downloadDirectory); // Set default download path


  options.AcceptInsecureCertificates = true;

  //options.AddUserProfilePreference("download.prompt_for_download", false); // Disable "Save As" dialog

  //options.AddUserProfilePreference("profile.default_content_settings.popups", 0); // Disable pop-ups

  //options.AddUserProfilePreference("profile.content_settings.exceptions.automatic_downloads.*.setting", 1); // Allow multiple file downloads

  //options.AddUserProfilePreference("safebrowsing.enabled", true); // Disable Chrome Safe Browsing

  //options.AddUserProfilePreference("safebrowsing.disable_download_protection", true); // Allow insecure downloads


  options.AddUserProfilePreference("profile.default_content_setting_values.mixed_script", 1); // Allow insecure scripts

  options.AddUserProfilePreference("profile.default_content_setting_values.insecure_content", 1); // Allow insecure content

  options.AddArgument("--allow-running-insecure-content"); // Allow HTTP content on HTTPS pages

  options.AddArgument("--disable-blink-features=AutomationControlled");// Prevent Chrome detection

  //options.AddArgument("--disable-popup-blocking"); // Disables popup blocking



  options.AddExcludedArgument("enable-automation");

Previous
Next Post »