Created
September 21, 2012 12:43
-
-
Save adamgoucher/3761256 to your computer and use it in GitHub Desktop.
Messing around with accepting messed up certificates
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from selenium.webdriver import Firefox | |
| from selenium.webdriver import Remote | |
| from selenium.webdriver.firefox.firefox_profile import FirefoxProfile | |
| from selenium.webdriver.common.desired_capabilities import DesiredCapabilities | |
| import pytest | |
| import time | |
| class TestInvalidSSL(object): | |
| def setup_method(self, method): | |
| pass | |
| def teardown_method(self, method): | |
| self.driver.quit() | |
| # should not work | |
| def test_without_capability(self): | |
| self.driver = Firefox() | |
| self.driver.get("https://tv.eurosport.com/") | |
| time.sleep(3) | |
| # should work | |
| @pytest.mark.adam | |
| def test_with_profile(self): | |
| profile = FirefoxProfile() | |
| profile.accept_untrusted_certs = True | |
| profile.webdriver_assume_untrusted_issuer = False | |
| self.driver = Firefox(profile) | |
| self.driver.get("https://tv.eurosport.com/") | |
| time.sleep(3) | |
| # should not work | |
| def test_remote_without_capability(self): | |
| command_executor = "http://localhost:4444/wd/hub" | |
| desired_capabilities = DesiredCapabilities.FIREFOX | |
| self.driver = Remote(command_executor=command_executor, desired_capabilities=desired_capabilities) | |
| self.driver.get("https://tv.eurosport.com/") | |
| time.sleep(3) | |
| # should work | |
| @pytest.mark.four | |
| def test_remote_with_capability(self): | |
| command_executor = "http://localhost:4444/wd/hub" | |
| desired_capabilities = DesiredCapabilities.FIREFOX | |
| desired_capabilities["acceptSslCerts"] = True | |
| self.driver = Remote(command_executor=command_executor, desired_capabilities=desired_capabilities) | |
| self.driver.get("https://tv.eurosport.com/") | |
| time.sleep(600) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment