Safari webdriver cannot bypass HTTPS certificate

2,147 views
Skip to first unread message

Rana Banerjee

unread,
Jan 22, 2013, 5:25:49 AM1/22/13
to seleniu...@googlegroups.com
Hi,

I am using selenium-server-standalone-2.28.0.jar to launch a HTTPS web application in Safari. I have configured safari browser as described in http://code.google.com/p/selenium/wiki/SafariDriver and been able to launch a HTTP website.

But when I launch any HTTPS website, the browser opens up in default port and trying to connect to the HTTPS site and prompts -
"Safari can't verify the identity of the website. The certificate for this website is invalid. Continue/Cancel/Show Certificate."

However, the same website can be opened using other browser like IE or Firefox. I tried installing the certificate in Safari and retried, but the same prompt came up.

Here is my code -

    public WebDriver loadDriver() throws Exception
   
{
       
DesiredCapabilities safariCapabilities = DesiredCapabilities.safari();
        safariCapabilities
.setCapability(CapabilityType.ACCEPT_SSL_CERTS, true);

       
if(isSupportedPlatform())
           
return new  SafariDriver(safariCapabilities);
       
else
           
throw new Exception("Unrecognized Platform for Safari");
   
}

   
private boolean isSupportedPlatform()
   
{
       
Platform current = Platform.getCurrent();
       
return Platform.MAC.is(current) || Platform.WINDOWS.is(current);
   
}



After loading driver, when I call driver.get(HTTPS_URL), the prompt is coming.

Is there any way to avoid this?

Thanks,
Rana

David

unread,
Jan 22, 2013, 5:13:37 PM1/22/13
to seleniu...@googlegroups.com
Are you having problem on both Safari on Mac and Windows or just one?

Rana Banerjee

unread,
Jan 24, 2013, 1:41:35 AM1/24/13
to seleniu...@googlegroups.com
I am using Safari on windows 7. Mac is currently out of scope for me.

Thanks,
Rana

David

unread,
Jan 24, 2013, 2:09:26 PM1/24/13
to seleniu...@googlegroups.com
Do you get same issue whether running test w/ Selenium for Safari vs manual testing in Safari browser? Just trying to narrow down issue.

I think Windows Safari takes certificate from Windows certificate store (same as IE method) so if you've installed the certificate for Windows/IE should be ok. On the safe side, try installing certificate within Safari (manually) if there's a way to do so, I forget.

I know for Mac, the certificate is to be installed via the Apple keychain certificate install process.

Sreedevi

unread,
Mar 18, 2014, 7:22:09 AM3/18/14
to seleniu...@googlegroups.com
Hi David,

I am doing selenium webdriver testing on MAC/safari. The certificate is installed on the MAC via the Apple keychain certificate install process.
Followed the link http://rationaleemotions.wordpress.com/2012/05/25/working-with-safari-driver/ to do the certificate installation

Even though the certificate is installed, i am getting the error "Safari can't verify the identity of the website. The certificate for this website is invalid. Continue/Cancel/Show Certificate."
Can you please tell, what might be causing the issue? How to make sure if the certificate is installed properly or not.

Below are the mac OS details:
ProductName: Mac OS X
ProductVersion: 10.6.8
BuildVersion: 10K549

Selenium version being used is : selenium-server-standalone-2.37.0.jar
Commands used to start Hub & Node:
java -jar selenium-server-standalone-2.37.0.jar -role hub -port 5678
java -jar selenium-server-standalone-2.37.0.jar -role node -hub http://localhost:5678/grid/register -browser "browserName=safari,setjavascriptEnabled=true,acceptSslCerts=true,maxInstances=5,platform=MAC"

Hub and node are started on the MAC machine

Please help me out.

Thanks & Regards,
Sreedevi

Krishnan Mahadevan

unread,
Mar 18, 2014, 7:27:21 AM3/18/14
to Selenium Users
Sridevi,
The blog you called out was mine :)
With respect to your certificate issue, I think its because you havent installed the certificate manually [ the error has got nothing to do with my post's contents. Infact that post itself is perhaps invalid now, because SafariDriver has streamlined itself a lot ]

Can you please try installing the certificate manually first and then trying to work with it [ You can refer here : https://support.quovadisglobal.com/KB/a59/how-do-i-install-a-digital-certificate-onto-apple-mac-os-x.aspx ]


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/
My Technical Scribbings @ http://rationaleemotions.wordpress.com/


--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-user...@googlegroups.com.
To post to this group, send email to seleniu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/80936301-b91e-4c81-8142-2a8ab57ed3f1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Ivan Harasym

unread,
Mar 5, 2015, 11:45:27 PM3/5/15
to seleniu...@googlegroups.com
Is there any updates on this? I have the same issue with accepting Safari SSL certificate.

вівторок, 22 січня 2013 р. 12:25:49 UTC+2 користувач Rana Banerjee написав:
Reply all
Reply to author
Forward
0 new messages