selectedOption - web automation propety

IE automation property that retrieves the selected option in a HTML drop-down / list-box web control.

Applies to:
  var option = elementObj.selectedOption;
If no option is selected then null is returned after searchTimeout has expired. It can be applied only to <select> objects, otherwise a web automation exception is thrown and the lastError property is set to INVALID_OPERATION_ERROR. In case of an error the method throws a script exception and the lastError property of the core object is set accordingly.

The time allocated for searching the selected option 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 web automation exception is thrown.
// Displays the selected option in a combo-box HTML control.
var coreObj = new ActiveXObject("OpenTwebst.Core");
var browser = coreObj.StartBrowser("");
var select  = browser.FindElement("select", "");

See also:
AddSelection | AddSelectionRange | ClearSelection | Element | GetAllSelectedOptions | Select | SelectRange

© 2017 CodeCentrix Software. All rights reserved.