Clicks a DOM element with a specified mouse button. A left-button click executes the default actions of the clicked element type.
BrowserAPI.bdh
BrowserClick( uTestObject : in union, nButton : in number optional, sTimer : in string optional ): boolean;
Parameter | Description |
---|---|
uTestObject | Either a locator that identifies the DOM element or a handle to a previously found DOM element. Throws an error if an invalid handle is used or if the locator cannot be resolved. |
nButton | Optional: The mouse button with which the DOM element is to be clicked. Specify BUTTON_LEFT to use the left mouse button (default), or BUTTON_RIGHT to use the right mouse button. You can combine mouse buttons with modifier keys using an OR operator. Specify MODIFIER_SHIFT, MODIFIER_ALT, or MODIFIER_CTRL for the respective modifier key. For example: BUTTON LEFT | MODIFIER_CTRL |
sTimer | Optional: Name of the timer used for page measurements. If this parameter is omitted, no measurements are performed. |
true if successful
false otherwise
benchmark SilkPerformerRecorder use "Kernel.bdh" use "BrowserAPI.bdh" use "WebAPI.bdh" dcluser user BDLTUser transactions TInit : begin; TMain(BROWSER_MODE_DISPLAY_VISIBLE) : 1; var gDemoSite:string; dclrand dcltrans transaction TInit begin gDemoSite := "http://demo.borland.com/InsuranceWebExtJS/"; end TInit; transaction TMain(mode:number) var sQuote,sExpected : string; begin BrowserStart(BROWSER_MODE_DISPLAY_VISIBLE | BROWSER_MODE_USERBEHAVIOR_FIRST_TIME); BrowserNavigate(gDemoSite, "Navigate to Demo Site"); if BrowserFind(HANDLE_DESKTOP , "//LABEL[@textContents='John Smith']", false, 0, true) = HANDLE_INVALID then BrowserClick("//INPUT[@id='login-form:email']", BUTTON_Left); BrowserSetText("//INPUT[@id='login-form:email']", "john.smith@gmail.com"); BrowserClick("//INPUT[@id='login-form:password']", BUTTON_Left); BrowserSetText("//INPUT[@id='login-form:password']", "john"); BrowserButtonSelect("//INPUT[@id='login-form:login']", "BrowserButtonSelect (#1)"); end; BrowserListBoxSelect("//SELECT[@id='quick-link:jump-menu']", "Auto Quote", "BrowserListBoxSelect (#1)"); BrowserRadioButtonSelect("//INPUT[@id='autoquote:vehicle:0']"); BrowserClick("//INPUT[@id='autoquote:zipcode']", BUTTON_Left); BrowserSetText("//INPUT[@id='autoquote:zipcode']", "555"); BrowserClick("//INPUT[@id='autoquote:e-mail']", BUTTON_Left); BrowserSetText("//INPUT[@id='autoquote:e-mail']", "john.smith@gmail.com"); BrowserButtonSelect("//INPUT[@id='autoquote:next']", "BrowserButtonSelect (#2)"); BrowserRadioButtonSelect("//INPUT[@id='autoquote:gender:0']"); BrowserRadioButtonSelect("//INPUT[@id='autoquote:type:0']"); BrowserButtonSelect("//INPUT[@id='autoquote:next']", "BrowserButtonSelect (#3)"); BrowserClick("//IMG[@hideFocus='0'][2]", BUTTON_Left, "BrowserClick (#3)"); BrowserClick("//DIV[@textContents='Chrysler']", BUTTON_Left, "BrowserClick (#4)"); BrowserClick("//IMG[@hideFocus='0'][3]", BUTTON_Left, "BrowserClick (#5)"); BrowserClick("//DIV[@textContents='Aspen']", BUTTON_Left); BrowserRadioButtonSelect("//INPUT[@id='autoquote:finInfo:0']"); BrowserButtonSelect("//INPUT[@id='autoquote:next']", "BrowserButtonSelect (#4)"); BrowserLinkSelect("//A[@textContents='Home']", "Select, A, textContents=Home (#1)"); BrowserButtonSelect("//INPUT[@id='logout-form:logout']", "Select, INPUT, href=http://demo.borland.com/InsuranceWebExtJS/index.jsf (#1)"); end TMain;