WebSetUserBehavior Function

Action

Specifies whether the user resets his browser emulation after each transaction. This function enables you to generate a simulation of a user who visits a Web site for the first time — if you specify to clear the document cache, the document history, the cookie database, the authentication databases, and the SSL context cache — or a user who revisits a Web site.

注: This function overrides the corresponding setting in the Simulation tab of the Profile Settings - Web dialog.

Include file

WebAPI.bdh

Syntax

WebSetUserBehavior(in nUserBehavior: number): boolean;

Return value

  • true if successful

  • false otherwise

Parameter Description
nUserBehavior

Specifies the user behavior. This parameter must be one of following values:

  • WEB_USERBEHAVIOR_DISABLE. The user does not reset his browser emulation during a test.

  • WEB_USERBEHAVIOR_FIRST_TIME. After each transaction, the user closes the persistent connections, resets his browser emulation, and clears the document cache, the document history, the cookie database, and the SSL context cache.

  • WEB_USERBEHAVIOR_REVISITING. After each transaction, the user closes the persistent connections and clears the document history, the non-persistent cookie database, and the SSL context cache.

Example

dcltrans
  transaction TInit
  begin
    WebSetDocumentCache(true, WEB_CACHE_CHECK_ALWAYS);
    // simulate a returning user, with all the documents
    // in the cache and cookies in the cookie database.
    WebSetUserBehavior(WEB_USERBEHAVIOR_REVISITING);
  end TInit;