BrowserListBoxSelect Function

Action

Selects an item in a DOM listbox. A DomListBox represents all DOM elements that are specified using the <select> tag.

Include file

BrowserAPI.bdh

Syntax

BrowserListBoxSelect( uTestObject : in union,
                      vItem       : in union,
                      sTimer      : in string optional ): boolean;
Parameter Description
uTestObject The XPath locator or the handle to the Listbox.
vItem The identifier of the list item to select. Items can be identified by their name or by their zero-based index. Names can also be combined with an index (for example, you could use blue[2] to identify the second item that has the value of blue).
sTimer Optional: Name of the timer used for page measurements. If this parameter is omitted, no measurements are performed.

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);
    BrowserNavigate("http://demo.borland.com/TestSite/gwt/Showcase.html#CwListBox");

    // select the first item in the listbox
    BrowserListBoxSelect("//SELECT[@multiple='-1']", "compact");
    // alternatively you can select items by their index (zero-based)
    BrowserListBoxSelect("//SELECT[@multiple='-1']", 1);    // select the second item
  end TMain;