Using Personal SSL certificates with Webdriver (Selenium 2.0)

前端 未结 3 902

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 se

3条回答
  •  醉话见心
    2020-12-16 04:47

    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:

    http://grepcode.com/file/repo1.maven.org/maven2/org.seleniumhq.selenium.server/selenium-server-coreless/1.0.3/org/openqa/selenium/server/TrustEverythingSSLTrustManager.java
    

    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.

提交回复
热议问题