FindChildrenElements - web automation method

Searches inside a container object, the list of direct child elements that match a tag-name and verifies a list of Search Conditions.

Applies to:
Frame, Element
  var elementList = obj.FindChildrenElements("tag_name", Search conditions);
Arguments:
This method accepts a variable number of Search Condition arguments. Any HTML attribute is accepted in search conditions. Text is also accepted as attribute in search conditions, in this case the text of the HTML element is used in search. If no search condition is provided, then the collection of all direct child elements that match the tag_name is returned.
Remarks:
The method returns an ElementList web automation object containing elements that match the search condition arguments and have the specified tag_name. If no element verifies the search conditions, then an empty list is returned.
In case of an error the method throws a script exception and the lastError property of the core object is set as follows:
The time allocated for search is specified by the searchTimeout property. The search is affected by useRegExp 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.

If the container object is a Frame, then the method searches the elements in the HTML document associated with the frame. If the container object is an Element, then the method searches the elements among the direct children elements of the container element.
Example:
// Display all the links in the <body> HTML element.
var coreObj = new ActiveXObject("Twebst.Core");
var browser = coreObj.StartBrowser("http://www.codecentrix.com/");

var textToDisplay = "";
var anchorList    = browser.FindElement("body").FindChildrenElements("a");
for (i = 0; i < anchorList.length; ++i)
{
	textToDisplay += anchorList(i).nativeElement.innerText + "\n";
}
WScript.Echo(textToDisplay);
		
See also:
Element | ElementList | FindAllElements | loadTimeout | searchTimeout | useRegExp

© 2014 CodeCentrix Software. All rights reserved.