BrowserWaitForDisappear Function

Action

This function is useful for custom synchronization. It can be used to wait until a certain DOM element becomes invisible or is detached from the document.

注: Automatic synchronization is also available. When automatic synchronization is turned on, replay functions wait until the browser has completed loading (including asynchronous remote calls and Javascript processing).

Include file

BrowserAPI.bdh

Syntax

BrowserWaitForDisappear( uTestObject : in union,
                         nTimeout    : in union optional ): boolean;
Parameter Description
uTestObject The XPath locator or the handle to the DOM element.
nTimeout Optional: The wait timeout in milliseconds. If not specified, the default timeout specified in the profile settings or set by BrowserSetOption(BROWSER_OPT_WAIT_TIMEOUT) will be used. When the timeout is reached, an error is thrown. Use the data type number for this parameter. The data type float is not allowed.

Return value

  • true if successful

  • false otherwise

Example

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 | BROWSER_MODE_USERBEHAVIOR_FIRST_TIME, 800, 600);
    
    // wait for DOM element to disappear (should disappear after 2.5 seconds)
    BrowserNavigate("http://demo.borland.com/TestSite/JavaScriptDisappear.html");

    BrowserWaitForDisappear("//SPAN[@id='ToHide']", 1000);
  end TMain;