BrowserSetCertificate Function

Action

Sets a client certificate of a given name for authentication and encryption purposes. Usually the certificate to be used must be selected via a selection dialog box. This function stores the certificate temporarily in the Silk Performer runtime so that it can be used by the following API call without user interaction.

The certificate APIs work with Microsoft Windows 7 or later, Microsoft Windows Server 2008 R2 or later, and Internet Explorer 8 or later.

Note: Review the following Microsoft support article for more details: http://support.microsoft.com/KB/308087. In particular, note that the Internet Explorer option Check for server certificate revocation must be disabled.
Note: This function only works with Internet Explorer.

Include file

BrowserAPI.bdh

Syntax

BrowserSetCertificate( sCertificatename : in string, 
                       sCertstore       : in string optional ): boolean;
Parameter Description
sCertificatename The certificate to be used.
sCertstore Optional: The certificate store name. When this parameter is not specified certificates are loaded from the My store, available on the certificate tab's Personal tab.

Return Value

  • true if successful

  • false otherwise

Example

Note: The following example does not work out-of-the-box, as you first need to set up a certificate in order to execute actions on it.
benchmark SilkPerformerRecorder

use "Kernel.bdh"
use "BrowserAPI.bdh"

dcluser
  user
    VUser
  transactions
    TInit           : begin;
    TMain           : 1;

var

dclrand

dcltrans
  transaction TInit
  begin
  end TInit;

  transaction TMain
  begin
    BrowserStart(BROWSER_MODE_DEFAULT, 800, 600);
    
    // set the authentication for the secure site
    BrowserSetCertificate("John Smith");
    // navigate to the secure site
    BrowserNavigate("https://testsite/clientcert/servervar.asp");
  end TMain;