Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8285187
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T11:24:17+00:00 2026-06-08T11:24:17+00:00

I am working on Selenium 2 & C#. I have a certificate problem in

  • 0

I am working on Selenium 2 & C#. I have a certificate problem in IE9. I am executing my Selenium Test script and get to the page: “There is a problem with this website’s security certificate”.

When I tried to click the link “Continue to this website (not recommended)” using: driver.FindElement(By.Id("overridelink"));, Selenium didn’t recognize it, it couldn’t click the link.

Would you please let me know if someone knows how to fix this issue?

This is my code:

DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.SetCapability(CapabilityType.AcceptSslCertificates, true); 
WebDriverObj = new InternetExplorerDriver(capabilities);
MyBrowser = new WebDriverBackedSelenium(WebDriverObj, "http://www.google.com");
WebDriverObj.Navigate().GoToUrl("https://mywebsiteUrl");

WebDriverObj.Navigate().GoToUrl("javascript:document.getElementById('overridelink').click()");

IWebElement uname = WebDriverObj.FindElement(By.Id("ctl00_uxContentPlaceHolder_uxUsername"));
uname.SendKeys("username");
IWebElement pwd = WebDriverObj.FindElement(By.Id("ctl00_uxContentPlaceHolder_uxPassword"));
pwd.SendKeys("pass*");
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T11:24:18+00:00Added an answer on June 8, 2026 at 11:24 am

    Here is the python version that I found somewhere:

    def certificate_continue():
        """
        Find the IE Window that has a Certificate Error and try to continue anyway.
        We'll use the win32 modules to find the right window & child window,
        then write some Javascript into the address bar and execute to continue.
        """
        def _enumWindowsCallback(hwnd, windows):
            """
            This appends window information as a 3-tuple to the list
            passed into win32gui.EnumWindows()
            """
            class_name = win32gui.GetClassName(hwnd)
            # apparently win32gui.GetWindowText() only works to get the text
            # on a button or a label not really for edit windows.
            text = win32gui.GetWindowText(hwnd)
            windows.append((hwnd, class_name, text))
    
    
        def _get_certificate_error_window():
            """
            all_windows[] gets filled up with a list of tuples, then loop through
            it filtering on class and the window text (title bar text).
            Assumes only one 'Certificate Error' window.
            """
            all_windows = []
            win32gui.EnumWindows(_enumWindowsCallback, all_windows)
            for win in all_windows:
                class_name = win[1]
                title_bar_text = win[2]
                if class_name == 'IEFrame' and \
                         'Certificate Error: Navigation Blocked' in title_bar_text:
                    return win
    
        def _get_edit_text(hwnd):
            buf_size = win32gui.SendMessage(hwnd, win32con.WM_GETTEXTLENGTH, 0, 0)
            buf_size += 1 # don't forget that null character boys...
            buffer = win32gui.PyMakeBuffer(buf_size)
            win32gui.SendMessage(hwnd, win32con.WM_GETTEXT, buf_size, buffer)
            # don't need the null character now for Python
            return buffer[:buf_size]
    
    
        def _get_address_bar(parent_handle):
            """
            There appears to be several 'Edit' windows within each browser window.
            From Microsoft: If a child window has created child windows of its own,
            EnumChildWindows enumerates those windows as well.
            """
            childwins = []
            win32gui.EnumChildWindows(parent_handle, _enumWindowsCallback,
                                      childwins)
            for win in childwins:
                child_handle = win[0]
                class_name = win[1]
                if 'Edit' in class_name:
                    edit_text = _get_edit_text(child_handle)
                    if 'http://' in edit_text or 'https://' in edit_text:
                        return child_handle  # then this must be it...
    
    # begin certificate_continue
        target_win = _get_certificate_error_window()
        try:
            cert_err_handle = target_win[0]
        except TypeError:
            print "OK, no Certificate Error window available"
            return(1)
    
        address_bar_handle = _get_address_bar(cert_err_handle)
        # any better way to check the handle ?
        if not win32gui.IsWindow( address_bar_handle):
            print "Choked getting IE edit window"
            return(1)
    
        # now, need to send this JavaScript text to the browser Address Bar
        javascript_continue = 'javascript: var continue_element = document.getElementById("overridelink"); continue_element.click();'
        win32gui.SendMessage(address_bar_handle, win32con.WM_SETTEXT, 0,
                         javascript_continue)
    
        # OK, and finally, send a carriage return to the address bar
        win32gui.SendMessage(address_bar_handle, win32con.WM_KEYDOWN,
                         win32con.VK_RETURN, 0)
        return(0)
    

    Now just call certificate_continue() after you call the driver.get to the SSL url. This worked (works) for me with ie9.

    Hope this helps

    A

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've recently updated to Selenium 2.24.1 to get Firefox 13 working. With this update
Background I have been working towards automating my Selenium test suite that I developed
Working with H2 I get this error when I try to write a row
I am new to Selenium. I am working with c#. There is a table
I'm testing a web page using selenium. I want to get all the 'leaf
I have Selenium server working with PHPUnit on a MAMP local server. When an
I am working on a website scraping project using Selenium in Python. When I
I am working on parsing a html page. I tried spynner, selenium, mechanize but
I'm migrating our Selenium test to WebDriver and there is a test which use
I exported a working Selenium test case to Java, running it via selenium-rc's selenium-server.jar

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.