item - web automation property

Retrieves an Element, Frame or Browser object from a collection based on a given index.

Applies to:
ElementList
  var obj = objList.item(index);
Arguments:
Remarks:
Because item is the default property of the list objects, it can be omitted. In this case, the index can applied directly to the list object (see the example bellow). If the index parameter is greater than the index of the last object in the list, a browser macro exception is thrown. In this case the lastError property of the Core object is set to INDEX_OUT_OF_BOUND_ERROR.
Example:
// Displays all anchors in a web page.
var coreObj = new ActiveXObject("OpenTwebst.Core");
var browser = coreObj.StartBrowser("http://www.codecentrix.com/");
var anchors = browser.FindAllElements("a", "");
var text    = "";

for (var i = 0; i < anchors.length; ++i)
{
	text += anchors.item(i).uiName;
	text += "\n";
}

WScript.Echo(text);
		
See also:
ElementList | length

© 2017 CodeCentrix Software. All rights reserved.