On this page:

Your Rating:
Results:
PatheticBadOKGoodOutstanding!
19 rates

This page is solely intended for use with the Private Synthetic Agent. You will not be able to run some of the synthetic scripts below with the Hosted Synthetic Agent.

When using client certificates, you may need to select the certificate from a dialog. To do this, you will need to install the Python pyautogui library on the host machine of your Private Synthetic Agent. The pyautogui library enables you to navigate the UI to select a client certificate.

Install the pyautogui Library

To install the PyAutoGUI Library:

  1. Log in to the host machine for the Private Synthetic Agent as the agent_user.
  2. Open a PowerShell console.
  3. Use pip to install the library: > pip install pyautogui

Select the Only Client Certificate

When you manually navigate to a site that uses client certification, IE10 may prompt you with an alert dialog to select one client certificates as seen below:

To select the client certificate from a synthetic script, your code could focus on the alert dialog and accept the given client certificate as performed by the synthetic script below.

sslUrl = "https://yourdomain.com/"
driver.get(sslUrl)
# Move focus to the dialog
alert = driver.switch_to_alert()
# Accept the client cert
alert.accept()

Select Certificate from List

In the case where your synthetic job needs to select one client certificate from a list presented in the alert dialog as shown below, you can use the PyAutoGUI Library to select and accept the client certificate that you want. 

In the example below, you use switch_to_alert to focus on the alert dialog, and then use the pyautogui library to navigate to the correct certificate (tab), select it (enter), and then navigate to the OK button to select it (tab, enter). 

import pyautogui
pyautogui.FAILSAFE = False
sslUrl = "https://yourdomain.com/"
driver.get(sslUrl)
driver.switch_to_alert()
pyautogui.press(['tab', 'enter', 'tab', 'enter'])

You may have many more client certificates to choose from, so you will have to figure out the best way to use the PyAutoGUI APIs to navigate around the alert dialogue to select and accept the correct client certificate. See Keyboard Control Functions in the PyAutoGUI documentation for more information.

  • No labels