BrowserGetText Function

Action

Retrieves the text of any DOM element, like list boxes, radio buttons, and so on.

Include file

BrowserAPI.bdh

Syntax

BrowserGetText( uTestObject : in union,
                sText       : out string ): boolean;
Parameter Description
uTestObject The XPath locator or the handle of the DOM element.
sText The text output parameter.

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
    liHandle : number;
    liText : string;
  begin
    BrowserStart(BROWSER_MODE_DEFAULT, 800, 600);
    BrowserNavigate("http://demo.borland.com");
    
    // find the first list item (LI) tag on this page and store it into a variable (liHandle)
    liHandle := BrowserFind(HANDLE_DESKTOP, "//LI");    
    // Alternative: find the first list item (LI) tag on this page and store it internally (HANDLE_STORED)
    BrowserFind(HANDLE_DESKTOP, "//LI", true);    
    // get the text of the list item and print it
    BrowserGetText(liHandle, liText);
    print(liText);    
    //Alternative: Get the text of the list item and print it
    BrowserGetText(HANDLE_STORED, liText);
    print(liText);
  end TMain;