Watch and Select Client Certificate

Awaits the request for a digital certificate and selects it.

Command availability: IBM RPA SaaS and IBM RPA on premises

Script syntax

IBM RPA's proprietary script language has a syntax similar to other programming languages. The script syntax defines the command's syntax in the script file. You can work with this syntax in IBM RPA Studio's Script mode.

watchAndSelectClientCertificate --browser(Browser) [--issuer(String)] [--subject(String)] [--interval(TimeSpan)] [--stopAfterSelection(Boolean)] (CancellationTokenSource)=value

Dependencies

Use the Wait for Element in a Web Page (webWaitElement) command to give your bot time to find and select the certificate, otherwise, the bot keeps running, leading to errors.

Note:As selector for the Wait for Element in a Web Page (webWaitElement) command, use the XPath or ID of some element of the page that will be loaded after selecting the certificate.

Input parameters

The following table displays the list of input parameters available in this command. In the table, you can see the parameter name when working in IBM RPA Studio's Script mode and its Designer mode equivalent label.

Designer mode label Script mode name Required Accepted variable types Description
Browser browser Required Browser Instance of a browser.

Note:It is a variable of type "Browser" that stores the instance of a browser. Currently, it only supports Google Chrome and Firefox.
Issuer issuer Optional Text Issuer of the certificate to be selected.

Note:Corresponds to the field in the certificate, used to locate the certificate you prefer in the browser.
Applicant subject Optional Text Applicant for the certificate to be located.

Note:Corresponds to the field in the certificate, used to locate the certificate you prefer in the browser.
Certificate selection window XPath(Obsolete) xpath Optional Text XPath of the certificate selection window.

Note:This parameter is obsolete due to improvements made to IBM RPA tools.
Interval interval Optional Time Span Time interval between each search for the certificate.
Stop After Selection stopAfterSelection Optional Boolean Option to interrupt the selection after finding the certificate.

Output parameter

Designer mode label Script mode name Accepted variable types Description
Cancellation Token Source value Cancellation Token Source Cancellation token source used to interrupt the process.

Note:This output is a "Cancellation token source" variable, used to interrupt the process in which it was generated. To use this output, you must use the Cancel Token Source (cancelToken) command. If the Stop After Selection parameter is being used, it is not necessary to use the cancellation token, as the process is interrupted when locating the certificate. Otherwise, you must use the cancellation token.

Example

The command finds the client certificate in the browser to access a page/server, with attempts every 15 seconds. Attempts are stopped when locating the certificate.

defVar --name browser --type Browser
defVar --name cancellationtoken --type CancellationTokenSource
defVar --name web01 --type Browser
webStart --name browser --type "Chrome" web01=value
webNavigate --url "https://www.usa.gov"
watchAndSelectClientCertificate --browser ${web01} --issuer "Issuer Example" --subject "Applicant Example" --interval 00:00:15 --stopAfterSelectioncancellationtoken=value
cancelToken --token ${cancellationtoken}
webClose --name browser
Note:In order for the script to work correctly, it is necessary to have previously installed the certificate required in an authentication.

Limitations

The command must always be used before any interaction with a web page (navigation or click, for example). Its process takes place in the background and is only interrupted when the interrupt is defined in this command.