FindChildElement - web automation method
Searches inside a container object, a direct HTML child element that matches a tag-name and verifies a list of Search Conditions.
- Frame, Element
var e = obj.FindChildElement("tag_name", Search conditions);
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.
A special zero-based index attribute is available in search condition specifying the ordinal position in the collection of objects generated by the remaining search conditions.
If no search condition is provided, then the first element that matches the tag_name is returned.
tag_name is the HTML tag of the element to be found.
The method returns a web automation Element object that matches the search condition arguments and has the specified tag_name.
It provides programmatic control over the underlying IHTMLElement native object exposed by IE browser.
If no element verifies the search conditions, then null is returned.
In case of an error the method throws a macro 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 macro Frame object, then the method searches the element in the HTML document associated with the frame.
If the container object is a macro Element object, then the method searches the element among the direct children elements of the container element.
var coreObj = new ActiveXObject("Twebst.Core");
var browser = coreObj.StartBrowser("http://www.codecentrix.com/");
var element = browser.topFrame.FindChildElement("a", "text=Download");
- Element | FindElement | loadTimeout | searchTimeout | useRegExp
2014 CodeCentrix Software. All rights reserved.