BrowserActivateWindow Function

Action

Activates the window (tab) inside the web browser so that all following locator-based API calls work on the window.

Include file

BrowserAPI.bdh

Syntax

BrowserActivateWindow( uHandle : in number ): boolean;
Parameter Description
uHandle The handle returned by a previous BrowserGetActiveWindow call.

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
    wnd1   : number;
    wnd2   : number;
    check1 : number;
  begin
    BrowserStart(BROWSER_MODE_DEFAULT, 800, 600);    
    BrowserNavigate("http://demo.borland.com/TestSite/multiplewindows/multipleWindows.html");
    wnd1 := BrowserGetActiveWindow("mainWindow");
    BrowserLinkSelect("//A[@name='window1']",  "Select, BODY (#1)");
    wnd2 := BrowserGetActiveWindow("first window");
    BrowserActivateWindow(wnd1);
    BrowserLinkSelect("//A[@name='window2']",  "Select, BODY (#1)");
    
    BrowserCloseWindow(wnd2); // close second window (tab)
    BrowserCloseWindow();     // close active window (tab)
  end TMain;