Using Personal SSL certificates with Webdriver (Selenium 2.0)?

Webdriver has no built in mechanism for adding a personal cert.

Up vote 2 down vote favorite 2 share g+ share fb share tw.

I am testing a website which requires personal SSL certificates in order to do certain things, such as sign-in. I have a Webdriver (Selenium 2.0) test that I have set up with a proxy: Proxy localhostProxy = new Proxy(); localhostProxy. SetProxyType(Proxy.ProxyType.

MANUAL); localhostProxy. SetHttpProxy("www-proxyname:port"); FirefoxProfile profile = new FirefoxProfile(); profile. SetProxyPreferences(localhostProxy); driver = new FirefoxDriver(profile); And this will access the homepage fine.

The test then clicks the getText(); assertEquals(signInLinkText, username); } Thanks, Beccy selenium webdriver link|improve this question asked Apr 7 '11 at 8:21Beccy303.

Strangely, when I was running the test, I stopped it part way through and accessed the Firefox -> Preferences -> Advanced -> Encyption and selected the option to view certificates...the browser crashed on me. – Beccy Apr 11 '11 at 15:04.

Webdriver has no built in mechanism for adding a personal cert. If you are using firefox the only way that I have found to do this is to create a firefox profile and add the certificate to it. You can then either reuse the profile when you run your tests OR, and this is my prefered option, take the cert8.

Db and key3. Db files and add them to the profile that webdriver creates at runtime. I am not sure how yo do this in java, but in ruby I override the layout_on_disk method of FirefoxProfile to add the extra files I required.

Java has the same class so you should be able to do this same thing.

Webdriver can do this, although Derek is right and it isn't built in. All you need to do is make a custom Trust Manager that trusts all certs and then also override the "hostname verifier" to allow a non-real domain name. There is somewhat of an example I found on Google here: grepcode.com/file/repo1.maven.org/maven2... This is the same method you would use with Apache HC components to override SSL settings without using WebDriver.

I've used this method a lot with direct HTTP posts using Apache HT components and it "appears" that from the link above , this concept should also work with WebDriver.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions