Creating a Selenium Firefox test profile for SSL client-side certificates
You need to prepare a Selenium WebDriver Firefox profile into which there are imported client certificates.
First, you start WebDriver with the following configuration in the test code:
# Pre-seeded Firefox profile directory profile_directory = os.path.join(os.path.dirname(__file__), "..", "..", "certs", "firefox-client-ssl-profile") self.assertTrue(os.path.exists(profile_directory)) profile = FirefoxProfile(profile_directory)
Start unit tests and bring them to the testing point of the Zope test server. Stop the tests with "import pdb; pdb.set_trace ()"
You should now have a Firefox Selenium "WebDriver" instance on screen.
Import the client side certificate. Settings> Advanced> Encryption> View certificates. Import "client.p12" from your client certificate.
Visiting the URL launching the client certificate dialog box in Webdriver Firefox ::
https:
This should encourage you to accept the client side certificate on the test server. Take it all by hand.
Go to Help> Troubleshooting Information> Application Basics> Show in Finder. This opens a temporary directory containing active Webdriver profile files.
Copy the Firefox profile files cert8.db and key3.db to the unit test WebDriver Firefox package. This is the folder in which Selenium selects seeds for the Firefox web driver when running the firefox-client-ssl-profile test.
Abort tests. Restart the tests. Run before pause. In Webdriver Firefox, see the settings, which now contain the certificates that you approved the last time you started in Settings> Advanced> Encryption> View certificates.
Additional Information
Mikko ohtamaa
source share