BrowserSetProperty Function

Action

Changes the property values of the respective DOM element.

Include file

BrowserAPI.bdh

Syntax

BrowserSetProperty( uTestObject       : in union,
                    sDomPropertyName  : in string,
                    vDomPropertyValue : in union ): boolean;
Parameter Description
uTestObject The XPath locator or the handle to the DOM element.
sDomPropertyName The DOM property name.
vDomPropertyValue The value of the property.

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
  var
    propertyValue : boolean;
  begin
    BrowserStart(BROWSER_MODE_DEFAULT, 800, 600);
    BrowserNavigate("http://demo.borland.com/TestSite/gwt/Showcase.html#CwCheckBox");
    
    // check Monday
    BrowserSetProperty("//SPAN[@hideFocus='0']/INPUT[@hideFocus='0']", "checked", true);
    // get the value of the checked property and print it
    BrowserGetProperty("//SPAN[@hideFocus='0']/INPUT[@hideFocus='0']","checked", propertyValue);
    print(string(propertyValue));
    
    // uncheck Monday
    BrowserSetProperty("//SPAN[@hideFocus='0']/INPUT[@hideFocus='0']", "checked", false);
    // get the value of the checked property and print it
    BrowserGetProperty("//SPAN[@hideFocus='0']/INPUT[@hideFocus='0']","checked", propertyValue);
    print(string(propertyValue));
  end TMain;