To by pass unsigned SSL in firefox using Python

513 views
Skip to first unread message

Venu

unread,
Nov 7, 2013, 7:39:42 AM11/7/13
to seleniu...@googlegroups.com
I have a scearnio to by pass unsigned SSL certificate page. 
I  used below code but it is not working

firefoxprofile = webdriver.FirefoxProfile(profile_directory='/users/xyz/firefoxprofile') 
firefoxprofile.set_preference('webdriver_accept_untrusted_certs', True)
firefoxprofile.update_preferences()
driver = webdriver.Firefox(firefox_profile=firefoxprofile)


I have 50 more urls of the same device and our algorithm picks up one idle device randomly [these 50 devices have different ssl certificates] . 
I suppose trustAllSSLCertificates will handle above cases in case of Selenium 1. Is there a equivalent command in Python Webdriver  


Now I also tried adding certificate file to cert file in firefox profile. It is 80% consistent and not sure why it fails 20%

I am using firefox 12

Venu

unread,
Nov 8, 2013, 5:42:05 AM11/8/13
to seleniu...@googlegroups.com
I tried below ways but it didnt work. Is it possible to by pass SSL pages via python?

firefoxprofile = webdriver.FirefoxProfile(profile_directory='C:\\Users\\xyz\\Desktop\\DProfile')
firefoxprofile.accept_untrusted_certs = True
driver = webdriver.Firefox(firefox_profile=firefoxprofile)
driver.profile.accept_untrusted_certs = True
driver.get("http://1.0.0.11")

Is it possible to by pass ssl page via python. I have sample java code and it works fine

        ProfilesIni prof = new ProfilesIni();
        FirefoxProfile ff = prof.getProfile("DProfile2");

        WebDriver driver = new FirefoxDriver(ff);
        driver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS);
        driver.get("http://1.1.2.2");


driver = webdriver.Firefox() 
driver.desired_capabilities['acceptSslCerts'] = True 
driver.setAcceptUntrustedCertificates = True 
driver.setAssumeUntrustedIssueer = False
driver.get("http://1.1.2.2")

regards,
Venu

Venu

unread,
Nov 8, 2013, 8:19:26 AM11/8/13
to seleniu...@googlegroups.com
Dear Sir/Madam,
Is it possible to by pass ssl page via python. I have sample java code and it works fine and not sure why it is not working with python. Please share your suggestions

        ProfilesIni prof = new ProfilesIni();
        FirefoxProfile ff = prof.getProfile("DProfile2");
        WebDriver driver = new FirefoxDriver(ff);
        driver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS);
        driver.get("http://1.1.2.2")

Approach:
fp = webdriver.FirefoxProfile(profile_directory="C:\\Users\\DProfile")
fp.set_preference("webdriver_assume_untrusted_issuer", False)
fp.set_preference("webdriver_accept_untrusted_certs", True)
fp.accept_untrusted_certs = True
fp.update_preferences()
driver = webdriver.Firefox(firefox_profile=fp)
driver.get("http://1.3.2.1")

Approach2:
driver = webdriver.Firefox()
driver.desired_capabilities['acceptSslCerts'] = True
driver.setAcceptUntrustedCertificates = True 
driver.setAssumeUntrustedIssueer = False
driver.get("http://1.2.2.2")

On Thursday, 7 November 2013 18:09:42 UTC+5:30, Venu wrote:

Venu

unread,
Nov 18, 2013, 1:33:37 AM11/18/13
to seleniu...@googlegroups.com
Hi, 
Can you please let me know the firefox version and selenium version(irrespective of language) where you by passed SSL page. This information could help me in resolving the issue 

regards, 
Venu
Reply all
Reply to author
Forward
0 new messages