Take the 2-minute tour ×
Software Quality Assurance & Testing Stack Exchange is a question and answer site for software quality control experts, automation engineers, and software testers. It's 100% free, no registration required.

I have some Selenium 2 WebDriver test cases for Firefox and Internet Explorer 9. When I access HTTPS URLs on IE9 (Windows 7 64bit) I get:

There is a problem with this website's security certificate.

At this point the test hangs and eventually fails.

I tried:

  • Getting Selenium to click on the "Continue to this website (not recommended)." link. This can't be done as this error page is not your usual page. Same with JavaScript - it doesn't execute.

  • I tried adding the registry key (HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\MAIN\FeatureControl\FEATURE_ERROR_PAGE_BYPASS_ZONE_CHECK_FOR_HTTPS_KB954312) that prevents the certificate-error-page from displaying - didn't work. Probably because I'm on Windows 7 with IE9.

  • Following this advice I tried using BrowserMob proxy, but there's very little documentation out there and I couldn't work it out.

Finally, I don't have admin access to my PC - e.g. no access to group policies. Selenium 2 WebDriver works fine on Firefox. I have all security zones enabled in IE Internet Options and if I run the tests on other URLs (HTTP) then there is no problem.

Has anyone got a solution to this problem? Does anyone know hot to use BrowserMob proxy (or any other proxy) effectively to overcome this issue?

Thanks, Damo

share|improve this question
    
Did you ever find a solution for this? I have similar issues using watir-webdriver against IE as do others. It seems to be a webdriver issue. caused by something strange about that page. –  Chuck van der Linden Nov 10 '11 at 0:12
add comment

7 Answers

up vote 5 down vote accepted

There's a couple of solutions depending on how your particular company is set up. The easiest is if the machine that you're running the tests from is on the same domain as the server where the site is hosted. Have the team that manages the server to create a self-signed certificate and have the cert added to your machine. If the self-signed route doesn't work, you'll probably have to have another team involved. If there is someone who is able to issue a certificate from your production certificate authority, have them create and add to your test server. Then, import the certificate to your machine.

Was wrestling with this particular problem for months before our network and infrastructure teams heard about it and offered to help out.

share|improve this answer
    
I'll investigate and let you know how it went. Tried to up-vote you, but I have too few reputation points.. lol. Many thanks. –  damo_inc Oct 11 '11 at 6:46
2  
Self-signing I have found is the best solution in many of these scenarios, I did get the Security Exception add-ons for FF and IE8 to get around this in my environment. Have yet to try IE9 in my environment but I'm hoping it will be the same. –  MichaelF Oct 11 '11 at 20:33
add comment

Try to click the "Continue to this website (not recommended)." link in the following way (works for me on EI7, IE8):

webDriver.navigate().to("javascript:document.getElementById('overridelink').click()");
share|improve this answer
add comment

I am glad I found this message thread. I must have different version of webdriver and the following line works for me using IE8. Thanks.

    driver.execute_script("document.getElementById('overridelink').click()");

Edited to add: forgot to mention that my driver = webdriver.Ie() !

share|improve this answer
    
Hi Dave - welcome to SQA! I edited to add the info you gave in your second answer - I'll go delete that now otherwise it'll get confusing :) –  testerab Feb 9 '12 at 22:38
add comment

Navigate to the site first:

DesiredCapabilities capabilities = new DesiredCapabilities(); capabilities.setCapability(CapabilityType.ACCEPT_SSL_CERTS, true);
Webdriver driver = new InternetExplorerDriver(capabilities);
driver.get("your testing site");
driver.navigate().to("javascript:document.getElementById('overridelink').click()");
share|improve this answer
add comment

Yes Rama,

Its the fix for IE8. I have an application which has an expired certificate and I need to accept this certificate to proceed further.

In my framework I have to first navigate to the app's url by driver.get("appurl"), after this SSL error will be thrown. Now to handle this error i have used:

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

This way i was able to resolve this issue for IE8 and IE9 both.

share|improve this answer
add comment

Okay I just got it working under IE9 using C# and the following code:

IWebDriver driver = new InternetExploreDriver();
driver.Url("Site");
driver.Navigate().GoToUrl("javascript:document.getElementById('overridelink').click()");

And now it will go to the real page.

share|improve this answer
add comment

I have this code running always when I instance IE8 on my tests. Works fine.

#region SSL workaround for IE
if (driver.GetType() == typeof(InternetExplorerDriver) && driver.Title.Contains("Certificate"))
    driver.Navigate().GoToUrl("javascript:document.getElementById('overridelink').click()");
#endregion
share|improve this answer
    
Isn't the question about IE9, not IE8? –  corsiKa Jul 2 '13 at 4:46
    
Should work for both. –  Tedesco Jul 2 '13 at 8:11
add comment

protected by Bruce McLeod Jul 18 '13 at 0:30

Thank you for your interest in this question. Because it has attracted low-quality answers, posting an answer now requires 10 reputation on this site.

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.