Choosing a certificate from the Select a Certificate window using Selenium

7,708 views
Skip to first unread message

rahuld

unread,
Apr 14, 2008, 9:33:57 AM4/14/08
to selenium-users...@googlegroups.com

Hi,





Is it possible to select a certificate as part of client authentication using Selenium.


This scenario occurs when i access a website using "https" and before accessing the page ,i get a Choose a certificate dialog box.


Thanks in advance for any help,


Rahul



Wade Catron

unread,
Apr 17, 2008, 5:03:58 PM4/17/08
to selenium-users...@googlegroups.com

Hi Rahul,


I'm afraid any of the security warnings a browser throws cannot be accessed via Javascript in any way (for security reasons of course), so I'm fairly certain that what you're trying to do isn't currently possible with Selenium.


You might be able to achieve the desired result by using something like AutoIt or some other software that will click for you.






bruce

unread,
Apr 18, 2008, 12:46:53 AM4/18/08
to selenium-users...@googlegroups.com

for firefox,


1, visit this https url by hand when certificate pop up. select "accept permanently...."


2. let selenium server run with -fireforprofiletemplate mode,


the certificate would never pop up again.



derekmw

unread,
Aug 13, 2013, 9:57:46 AM8/13/13
to seleniu...@googlegroups.com, selenium-users...@googlegroups.com, clear...@openqa.org, bruc...@gmail.com
Sorry to resurrect an old thread, but does this information still stand?  We are using Selenium Webdriver with Ruby and trying to figure out a way to select the appropriate certificate (all our automation machines have various certificates installed and depending on the script being executed, the script needs to select the appropriate certificate.)

Is there any elegant way to do this besides resorting to kicking off some AutoIt script?

Krishnan Mahadevan

unread,
Aug 14, 2013, 3:42:09 AM8/14/13
to Selenium Users
Derek,

I am a bit confused with this requirement of yours.

Currently Firefox can deal with all sorts of certificates on its own, IE expects that the certificate be added manually on a machine (you would need to basically install the certificate on all your test machines on a one time basis), and chrome has switches for getting this done.

Wouldnt that solve your issue here ?





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/


--
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/10bea54e-70fb-45ec-b11a-5002a19c01ae%40googlegroups.com?hl=en-US.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

derekmw

unread,
Aug 14, 2013, 10:27:27 AM8/14/13
to seleniu...@googlegroups.com
Hi Krishan,

Yes, if there were only 1 certificate on each machine, this wouldn't be a problem I suppose.  Our problem is that each VM we run these scripts on have around 5 certificates installed.  Depending on which environment is currently being tested, the correct certificate installed needs to be selected form the Windows Security dialog prompt that comes up when you try to access the website.  I can't seem to find a way to interact with this Certificate selection window:

derekmw

unread,
Aug 14, 2013, 5:59:34 PM8/14/13
to seleniu...@googlegroups.com
Ok, so I'm still banging my head here not making much progress.  I figured I would try out the Auto-it method since I found out there is a ruby wrapper.  So the solution was pretty clean:
require './autoitwrapper.rb'
include AutoIt

ai = WIN32OLE.new("AutoItX3.Control")
ai.WinWaitActive("Windows Security")
ai.ControlClick("Windows Security", "", "OK")

The only problem with this solution is it just accepts whatever certificate is selected.  Autoit cannot see the list inside this Windows Security dialog containing the list of certificates.

I looked into using just ruby and WIN32OLE, but even when I do that, I cannot find this dialog box.  It only finds the actual Internet Explorer application.

Can anyone help out here?
Reply all
Reply to author
Forward
0 new messages