FindParentElement - web automation method
Searches a parent IHTMLElement up
in the HTML DOM hierarchy that matches a tag-name and verifies a list of Search Conditions.
var parent = element.FindParentElement("tag_name", Search conditions);
This method accepts a variable number of Search Condition arguments.
Any HTML attribute is accepted in search conditions. uiName is also accepted as attribute in search conditions,
in this case the text name of the HTML element is used in search. If no search condition is provided, the first
parent element that matches the tag_name is returned.
If the tag_name is empty, the first parent that matches the search condition arguments is returned.
tag_name is the HTML tag of the element to be found (can be empty string).
The method returns an web macro 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 IE 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.
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 IE automation exception is thrown.
var core = new ActiveXObject("OpenTwebst.Core");
var browser = core.StartBrowser("http://www.google.com/");
var elem = browser.FindElement("input text", "");
// Search the first parent having the name "f".
var parent = elem.FindParentElement("", "name=f");
WScript.Echo(parent.tagName + " " + parent.nativeElement.innerText);
- Element | FindElement | loadTimeout | parentElement | searchTimeout
2017 CodeCentrix Software. All rights reserved.