0

I am running non http url inside of my tests (so migration to https wont be easy) and because of that I am getting an warning inside of browser.

How to disable "Non secure" warning inside of Chrome during selenium tests?

Not secure address bar

I've tried to play with arguments but nothing works

 args: [
                      'start-maximized',
                      'disable-webgl',
                      'blacklist-webgl',
                      'blacklist-accelerated-compositing',
                      'disable-accelerated-2d-canvas',
                      'disable-accelerated-compositing',
                      'disable-accelerated-layers',
                      'disable-accelerated-plugins',
                      'disable-accelerated-video',
                      'disable-accelerated-video-decode',
                      'disable-gpu',
                      'disable-infobars',
                      'test-type',
                      'disable-extensions',
                      'allow-running-insecure-content',
                      'disable-web-security',
                      'ignore-certificate-errors',
                      'ignore-gpu-blacklist',
                      'no-default-browser-check',
                      'no-first-run',
                      'disable-default-apps'
                  ]

The issue is that I need to resize windows to 420x800 but because of warning browser can't do that.

undetected Selenium
  • 183,867
  • 41
  • 278
  • 352
Vova Bilyachat
  • 18,765
  • 4
  • 55
  • 80

2 Answers2

2

"Not Secure" SSL Error

As per Fix “Not Secure” SSL Error on Chrome Browser | Remove Warning with the release of Chrome 68, Google started showing all the HTTP sites as Not Secure on Chrome Browser.


Treatment of HTTP pages

HTTP_warning

This feature can be turned On / Off by accessing the page at chrome://flags/#enable-mark-http-as and setting the following attribute:

  • Mark non-secure origins as non-secure: Changes the UI treatment for HTTP pages on Mac, Windows, Linux, Chrome OS, Android
    • Default
    • Enabled
    • Enabled (mark as actively dangerous)
    • Enabled (mark with a Non Secure warning and dangerous on form edits)
    • Disabled

Using Selenium to disable this feature you need to use the ChromeOption --allow-running-insecure-content as follows:

  • Python:

    chrome_options = webdriver.ChromeOptions() 
    chrome_options.add_argument("start-maximized")
    chrome_options.add_argument('disable-infobars')
    chrome_options.add_argument('--allow-running-insecure-content')
    driver = webdriver.Chrome(chrome_options=chrome_options, executable_path=r'C:\Utility\BrowserDrivers\chromedriver.exe')
    driver.get("http://www.legislation.vic.gov.au/")
    
undetected Selenium
  • 183,867
  • 41
  • 278
  • 352
1

This does not work for chrome on android devices. It's a bad idea for companies to tell users what and what they can not look at. Tech giants like Google have gone too far and the government is letting it happen.

Bernice
  • 11
  • 1