I am testing a website that requires personalized SSL certificates to perform certain actions, such as logging in.
I have a Webdriver test (Selenium 2.0) that I installed 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 allow access to the home page. Then the test then clicks the login button, enters the correct credentials and clicks the "Submit" button. At this point, the browser enters the download state, and I assume that the SSL certificate is missing on my side and therefore cannot connect to the login service.
I searched for different proxy solutions and found this:
profile.setAcceptUntrustedCertificates(true); profile.setAssumeUntrustedCertificateIssuer(true);
So I added it to my code, but it doesn't seem to do what I want. I think I'm looking for a way to tell WebDriver that my ssl certificate is in the x directory, use it when accessing this site. Does anyone know how to do this?
My test code is:
@Test public void userSignsInAndVerifiesDrawerViews(){ driver.get("www.url.com"); waitFor(5000); driver.findElement(By.xpath("//a[contains(text(), 'Sign in')]")).click(); waitFor(3000); String username = "seleniumtest"; String password = "seleniumtest1"; driver.findElement(By.id("username")).sendKeys(username); driver.findElement(By.id("password")).sendKeys(password); driver.findElement(By.xpath("//signin")).click(); waitFor(30000); String signInLinkText = driver.findElement(By.xpath("//xpath")).getText(); assertEquals(signInLinkText, username); }
Thanks Beccy
source share