How to continue from "Certificate Error" page in IE

1,320 views
Skip to first unread message

Mike Riley

unread,
Jun 1, 2012, 2:16:42 PM6/1/12
to seleniu...@googlegroups.com
Okay, I have a weird one here.  I have a web page where I always get a certificate error, because I am forced to use IE and it is a self-signed certificate, that is being presented to me by a program acting as a web server (don't ask) so I can interact with it via Selenium.

I have attached a view of what the Developer Tools say the HTML looks like for the link to continue to the web page.

Based on that I have tried using selenium.click() with "link=Continue to this website (not recommended)." as well as "//a[text='Continue to this website (not recommended).']" and even "//a[@name='overridelink']" and just plain "overridelink" and none of them has worked.

So this morning I looked at the page source, using IE to bring it up, and it looks quite different.  So I am open to suggestions as to how to click on this bloody link.  In the page source it shows the anchor tag with an uppercase 'A'.  Do you think that would matter?

Here is what IE says is the page source:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML DIR="LTR">
<HEAD>
<link rel="stylesheet" type="text/css" href="ErrorPageTemplate.css" >
<META NAME="MS.LOCALE" CONTENT="EN-US">
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=utf-8">
<META HTTP-EQUIV="MSThemeCompatible" CONTENT="Yes">
<TITLE>Certificate Error: Navigation Blocked</TITLE>
<SCRIPT src="errorPageStrings.js" LANGUAGE="javascript" type="text/javascript">
</SCRIPT>
<script src="httpErrorPagesScripts.js" language="javascript" type="text/javascript">
</script>
<SCRIPT src="invalidcert.js" LANGUAGE="javascript" type="text/javascript">
</SCRIPT>
</HEAD>
<body ONLOAD="BodyLoad(); initMoreInfo('infoBlockID');" class="securityError">
<table width="730" cellpadding="0" cellspacing="0" border="0">
<!-- Main title -->
<tr>
<td id="shieldIconAlign" width="60" align="left" valign="top" rowspan="3">
<img src="red_shield_48.png" id="shieldIcon" alt="Shield icon">
</td>
<td id="mainTitleAlign" valign="middle" align="left" width="*">
<h1 id="mainTitle">There is a problem with this website's security certificate.</h1>
</td>
</tr>
<tr>
<td>
<h3>
<DIV ID="linkdiv" name="linkdiv" ></DIV>
</h3>
</td>
</tr>
<tr>
<!-- This row is for the the divider-->
<td id="errorCodeAlign" class="errorCodeAndDivider" align="right">&nbsp;
<div class="divider"></div>
</td>
</tr>
<!-- Error Body -->
<tr>
<td></td>
<td>
<h3>
<DIV ID="CertUnknownCA" name="CertUnknownCA" style="display='none'"></DIV>
<DIV ID="CertExpired" name="CertExpired" style="display='none'"></DIV>
<DIV ID="CertCNMismatch" name="CertCNMismatch" style="display='none'"></DIV>
<DIV ID="CertRevoked" name="CertRevoked" style="display='none'"></DIV>
<noscript id="securityCert1">The security certificate presented by this website has errors, and should not be trusted.
</noscript><br>
<ID id="securityCert2">Security certificate problems may indicate an attempt to fool you or intercept any data you send to the server.</ID>
</h3>
</td>
</tr>
<!-- Recommendation-->
<tr>
<td>&nbsp;</td>
<td><H2 id="recommendation"><b>We recommend that you close this webpage and do not continue to this website. </b></H2></td>
</tr>
<!-- close webpage-->
<tr>
<td >&nbsp;</td>
<td id="closeWebpageAlign" align="left" valign="middle">
<h4 id="closeWebpage">
<img src="green_shield.png" border="0" alt="Recommended icon" class="actionIcon"><a href="javascript:closePage()">Click here to close this webpage.</a>
</h4>
</td>
</tr>
<!-- continue to site-->
<tr>
<td >&nbsp;</td>
<td id="continueToSiteAlign" align="left" valign="middle">
<h4 id="continueToSite">
<img src="red_shield.png" ID="ImgOverride" border="0" alt="Not recommended icon" class="actionIcon"><A href='' ID="overridelink" NAME="overridelink" >Continue to this website (not recommended).</A>
</h4>
</td>
</tr>
<!-- InfoBlock -->
<tr>
<td id="infoBlockAlign" align="right" valign="top">
&nbsp;
</td>
<td id="moreInformationAlign" align="left" valign="middle">
<h4>
<table>
<tr>
<td valign="top">
<a href="#" onclick="javascript:expandCollapse('infoBlockID', true); return false;"><img src="down.png" id="infoBlockIDImage" border="0" class="actionIcon" alt="More information"></a>
</td>
<td valign="top">
<span id="moreInfoContainer"></span>
<noscript><ID id="moreInformation">More information</ID></noscript>
</td>
</tr>
</table>
</h4>
<div id="infoBlockID" class="infoBlock" style="display: none">
<p>
<li id="errorExpl1">If you arrived at this page by clicking a link, check the website address in the address bar to be sure that it is the address you were expecting.</li>
<li id="errorExpl2">When going to a website with an address such as https://example.com, try adding the 'www' to the address, https://www.example.com.</li>
<li id="errorExpl3">If you choose to ignore this error and continue, do not enter private information into the website.</li>
</p>
<p id="moreInfoSeeHelpPF">For more information, see "Certificate Errors" in Internet Explorer Help.</p>
</div>
</td>
</tr>
</table>
</body>
</html>

CertificateError.png

Krishnan Mahadevan

unread,
Jun 1, 2012, 2:18:25 PM6/1/12
to seleniu...@googlegroups.com
Have you tried manually installing that cert into IE and retried?
--
Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"
My Scribblings @ http://wakened-cognition.blogspot.com/

Mike Riley

unread,
Jun 1, 2012, 2:28:54 PM6/1/12
to seleniu...@googlegroups.com
Yep.  No joy there.  I am guessing this is because it is self-signed (or something like that), so the certificate info changes each time.

Once I get past this I am good as long as the browser stays up.  I can even close the tab it is in, or go to another site, and come back to it and it doesn't complain again.  You only get the issue showing up the first time you visit the site for that IE browser session.

I already talked to the developer about doing away with the need for HTTPS, but he is reusing existing framework code that is designed to always run with HTTPS and is not going to rewrite it to solve the issue.

Mike

Mike Riley

unread,
Jun 1, 2012, 3:14:43 PM6/1/12
to seleniu...@googlegroups.com
I just ran a test where I tried every variant I could think of to match this code and non worked.

Here is the list I tried:
        String locators[] =
        {
            "name=overridelink",
            "overridelink",
            "//A[text()='Continue to this website (not recommended).']",
            "//a[text()='Continue to this website (not recommended).']",
            "//A[@name='overridelink']",
            "//a[@name='overridelink']",
            "//A[@NAME='overridelink']",
            "//a[@NAME='overridelink']",
            "//A[@id='overridelink']",
            "//a[@id='overridelink']",
            "//A[@ID='overridelink']",
            "//a[@ID='overridelink']",

            "link=Continue to this website (not recommended)."
        };

It is like Selenium is seeing something different from what either of these views is telling me the code looks like!  This is getting frustrating!

Mike

Mike Riley

unread,
Jun 1, 2012, 5:03:57 PM6/1/12
to seleniu...@googlegroups.com
I think I get it now.  Since this page is produced inside IE9 they used their bastardized version of HTML and broke dozens of rules in composing it.  I did a selenium.getHtmlSource() and saved the result out in a file.  I then loaded it into Netbeand IDE and you should see all the warnings and errors!

So just for grins I brought up the same page in IE9 and saved that out as HTML (using Save as... in the browser) and it looks much cleaner.  I only see two minor warnings about using collapsed="true" in it for a couple of div tags, and this version of Netbeans doesn't understand HTML5, so even those are probably fine.

I am going to try this code later using IE9 and see if it works better and report my results back here.

Mike

BTW - Here is the relevant HTML code where that link is that I would be clicking on (it is the h2 tag):

Mike Riley

unread,
Jun 1, 2012, 5:53:06 PM6/1/12
to seleniu...@googlegroups.com
My bad.  That wasn't IE9 I saw, but Firefox (the icons are right next to each other and I must have clicked the wrong one).  Unfortunately, this web page is only viewable in IE, because only it allows for the bad HTML it present.

Time to file a bug with our developers, I guess.  I need to be able to use something other than IE.  Preferably Firefox, where I can prevent it complaining about the certificate.

Mike
Reply all
Reply to author
Forward
0 new messages