selectedOption - web automation propety

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

Applies to:
Element
  var option = elementObj.selectedOption;
Arguments:
None.
Remarks:
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.
Example:
// Displays the selected option in a combo-box HTML control.
var coreObj = new ActiveXObject("OpenTwebst.Core");
var browser = coreObj.StartBrowser("http://www.codecentrix.com/tests/qt3.htm");
var select  = browser.FindElement("select", "");

WScript.Echo(select.selectedOption.uiName);
		
See also:
AddSelection | AddSelectionRange | ClearSelection | Element | GetAllSelectedOptions | Select | SelectRange

© 2017 CodeCentrix Software. All rights reserved.