BrowserWaitForProperty Function

Action

This function is useful for custom synchronization. It can be used to wait until a property has a certain value. As soon as the property has the specified value, the function returns. When the timeout is reached, an error is thrown.

Note: 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

BrowserWaitForProperty( uTestObject       : in union,
                        sDomPropertyName  : in string,
                        vDomPropertyValue : in union,
                        nTimeout          : in union optional ): boolean;
Parameter Description
uTestObject The XPath locator or the handle to the DOM element.
sDomPropertyName The DOM property name.
vDomPropertyValue The value to be waited for.
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, 800, 600);
    
    // wait for dom element to alter checked state (should be checked after 2.5 seconds)
    BrowserNavigate("http://demo.borland.com/TestSite/JavaScriptDisappear.html");
    
    BrowserWaitForProperty("//INPUT[@id='ToChange']", "checked", true);
  end TMain;