Advertisement
SeleniumETrainR

How to Handle untrusted SSL certificates using selenium webd

Dec 14th, 2012
299
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.90 KB | None | 0 0
  1. import org.openqa.selenium.WebDriver;
  2. import org.openqa.selenium.firefox.FirefoxDriver;
  3. import org.openqa.selenium.firefox.FirefoxProfile;
  4. import org.openqa.selenium.firefox.internal.ProfilesIni;
  5.  
  6.  
  7. public class testHandleFireFoxcertificatesIssue {
  8.  
  9.      
  10.     public static void main(String[] args) {
  11.        
  12.         //Class ProfilesIni details -> http://selenium.googlecode.com/svn/trunk/docs/api/java/index.html
  13.                 ProfilesIni allProfiles = new ProfilesIni();
  14.                
  15.                 //Class FirefoxProfile -> http://selenium.googlecode.com/svn/trunk/docs/api/java/index.html
  16.                 // Use FirefoxProfile Constructor
  17.                 FirefoxProfile myProfile = allProfiles.getProfile("CertificateIssue");
  18.                
  19.                 myProfile.setAcceptUntrustedCertificates(true);
  20.                 myProfile.setAssumeUntrustedCertificateIssuer(false);
  21.                 WebDriver myDriver = new FirefoxDriver(myProfile);
  22.                
  23.                 myDriver.get("http://www.paypal.com");
  24.                
  25.                
  26.  
  27.     }
  28.  
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement