rwbyrd
rwbyrd

Reputation: 416

Bypass Security Certificate page on Microsoft Edge for Selenium Webdriver

I'm trying to bypass the Security Certificate page for Microsoft Edge for Selenium Webdriver using Python.

enter image description here

I attempted solutions that worked for previous versions of Internet Explorer that I found at this thread, but none of them worked.

driver.get("javascript:document.getElementById('overridelink').click();");

It seems like something close to the code above would probably work, but the Security Certificate page on Microsoft Edge is clearly different in some way.

Upvotes: 2

Views: 4552

Answers (1)

rwbyrd
rwbyrd

Reputation: 416

There are a few things you need to do to get past this Security Certificate screen.

  • Locate the desired_capabilities class, which should be located somewhere in you Python folder. It'll be in the file desired_capabilities.py.

i.e. C:\PythonXX\Lib\site-packages\selenium\webdriver\common

  • In desired_capabilities.py, Make sure the default desired capabilities object for the Microsoft Edge webdriver has “javascriptEnabled” set to “True”. You may have to add the code for this.

enter image description here

  • In the section of your code that encounters the Security Certificate page, verify you’re on the Security Certificate page and use javascript to select the continue option.

    if "Certificate error" in driver.title:
        driver.get("javascript:document.getElementById('invalidcert_continue').click()")
    

The name of the object responsible for continuing passed the Security Certificate page is different for Microsoft Edge than it is for IE. Hope this helps.

Upvotes: 3

Related Questions