2

I'm trying to get my tests to ignore the chrome warning message of "site is using a connection that's not secure".

What do i need to set to get webdriver to either ignore this, or set the chrome options. Currently its just set as headless.

ChromeOptions co = new ChromeOptions(); co.addArguments("headless","disable-gpu");

I have tried --allow-running-insecure-content but that doesn't seem to work.

Greg Burghardt
  • 17,900
  • 9
  • 49
  • 92
user1555190
  • 2,803
  • 8
  • 47
  • 80

2 Answers2

1

I think you are looking for --ignore-certificate-errors.

co.addArguments("headless","disable-gpu", "--ignore-certificate-errors");

Also:

co.setCapability(CapabilityType.ACCEPT_SSL_CERTS, true);
co.setCapability(CapabilityType.ACCEPT_INSECURE_CERTS, true);
Jortega
  • 3,616
  • 1
  • 18
  • 21
  • do we need to add the two hyphens... i have seen some examples with and without. – user1555190 Mar 18 '21 at 13:38
  • @user1555190 I think that depends on the language you are using to run selenium. – Jortega Mar 18 '21 at 13:41
  • If you want to keep trouble shooting we can use this stackoverlfow chat room, someone in there might know. https://chat.stackoverflow.com/rooms/223360/selenium – Jortega Mar 18 '21 at 16:03
  • Let us [continue this discussion in chat](https://chat.stackoverflow.com/rooms/230093/discussion-between-user1555190-and-jortega). – user1555190 Mar 18 '21 at 16:22
0

this might be due to mixed content, or if your navigating from a https url to http url in your test, explore chrome://flags and localstate in chrome app data folder https://blog.chromium.org/2020/08/protecting-google-chrome-users-from.html

OpenQA.Selenium.Chrome.ChromeOptions ops = new OpenQA.Selenium.Chrome.ChromeOptions();
System.Collections.ArrayList expPref = new System.Collections.ArrayList();
expPref.Add("mixed-forms-interstitial@2");     
ops.AddLocalStatePreference("browser.enabled_labs_experiments", expPref);
var service = ChromeDriverService.CreateDefaultService();
var driver = new OpenQA.Selenium.Chrome.ChromeDriver(service, ops, TimeSpan.FromSeconds(60));