Select - web automation method
Browser automation method that selects options in HTML combo-box (drop-down) or list-box web controls.
Applies to:
- Element
elementObj.Select(item_to_select);
Arguments:
-
-
item_to_select
is the text or the ordinal position of the option to be selected.
Remarks:
-
Any previous selection in the HTML drop-down / listbox control is removed.
The input parameter can be:
- a number that represents the zero-based ordinal position of the option to be selected.
-
a string that represents the text of the option to be selected.
If useRegExp property is true:
- For multiple selection list-box all the options that match the input regular expression are selected.
- For combo-box (drop-down) and single selection list-box, the first option that matches the input regular expression is selected.
If no option matches the input parameter, then a browser automation exception is thrown and the lastError property is set to NOT_FOUND_ERROR
If the browser automation method is applied to an Element that is not a combo-box (drop-down) or list-box control, then a browser automation exception is
thrown and the lastError property is set to INVALID_OPERATION_ERROR.
The time allocated for selecting the options is specified by the searchTimeout property. If loadTimeout is not zero, then the method waits the browser objects to be completely loaded in the amount of time specified by the property.
If the timeout has expired the lastError property is set to LOAD_TIMEOUT_ERROR. In this case, if loadTimeoutIsError property is true, then a script exception is thrown.
Example:
// Assume nativeCombo is a <select> HTML element.
// Select the first item in the combo-box.
var coreObj = new ActiveXObject("Twebst.Core");
var combo = coreObj.AttachToNativeElement(nativeCombo);
combo.Select(0);
See also:
- AddSelection | AddSelectionRange | Click | ClearSelection | Element | GetAllSelectedOptions | InputText | selectedOption | SelectRange
©
2014 CodeCentrix Software. All rights reserved.