BrowserHighlight Function

Action

This function can be used to highlight an object by changing its background and foreground color.

注: All valid HTML color-name formats are supported by this function (for example, both Red and #ff0000 are supported).

Include file

BrowserAPI.bdh

Syntax

BrowserHighlight( uTestObject : in union,
                  sForeground : in string,
                  sBackground : in string ): boolean;
Parameter Description
uTestObject The XPath locator or the handle to the DOM element.
sForeground The foreground color that should be used to highlight the object, for example Red or #ff0000.
sBackground The background color that should be used to highlight the object, for example Red or #ff0000.

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;
  begin
    BrowserStart(BROWSER_MODE_DEFAULT, 800, 600);
    BrowserNavigate("http://demo.borland.com");
    liHandle := BrowserFind(HANDLE_DESKTOP, "//LI");
    
    // highlight the first list item with a yellow background, wait 5 seconds and then undo the highlighting
    BrowserHighlight(liHandle, "black", "yellow");
    Wait(5.0);
    BrowserUnhighlight(liHandle);
  end TMain;