item - web automation property

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

Applies to:
BrowserList, ElementList, FrameList
  var obj = objList.item(index);
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.
// Find all existing browsers using a regular expression.
// Display the title of  all browsers in the list.
var coreObj         = new ActiveXObject("Twebst.Core");
coreObj.loadTimeout = 0;
coreObj.useRegExp   = true;

var titles      = "";
var browserList = coreObj.FindAllBrowsers("title=.*");
for (i = 0; i < browserList.length; ++i)
	// The line bellow can be also writen like: titles += browserList(i).title;

	titles += browserList.item(i).title;
	titles += "\n";

See also:
BrowserList | ElementList | FrameList | length

© 2014 CodeCentrix Software. All rights reserved.