WaitElement method to delay the script run until the specified web element becomes available to TestComplete. You specify the web element either by using the XPath syntax (see www.w3schools.com/xml/xpath_syntax) or the CSS selector syntax (see www.w3.org/TR/selectors).
Note: If you have another version of TestComplete, please check the requirements for your version.
An active license for the TestComplete Web Module.
The Web Testing plugin must be enabled in TestComplete (it is installed and enabled by default).
|TestObj||A variable, parameter or expression that specifies a reference to one of the objects listed in the Applies To section|
|Timeout||[in]||Optional||Integer||Default value: -1|
|Result||An object or a null object|
The method is applied to the following object:
To view this method in the Object Browser panel and in other panels and dialogs, activate the Advanced view mode.
The method has the following parameters:
Specifies the search condition. Can be either an XPath expression or a CSS selector.
The search expression must comply with the XPath rules. For more information on them, see XPath documentation. For instance, you can find XPath Reference in the MSDN Library.
The search expression must contain the names of HTML elements and attributes. Do not use Name Mapping aliases.
The element and attributes names in the search expression are case-insensitive. That is, you can specify them either in the upper case, or in the lower case.
However, the element and attribute values, which you specify in the search expression, are case-sensitive. For instance, image1.PNG, IMAGE1.PNG and Image1.png are different values for XPath. The search expression must specify values in the same case, in which they are specified in the source code of the page.
In search expressions, you can use XPath 1.0 functions like
XPath 2.0 functions (like
matches()and others), Microsoft extensions and other third-party extensions to XPath functions are not supported.
The table below contains some examples of XPath expressions:
||All IMG elements whose src attribute contains the plusBtn.gif substring.|
||All P elements that are located at the first position within
||All web page elements that have the align attribute set to center.|
||A collection of direct children of any UL element.|
||The last LI element within the UL element that has the id attribute set to ProductList.|
||All A elements that are descendants of any DIV element.|
A search expression containing one or more CSS selectors. For more information on them, see CSS selector syntax documentation. For example, you can find it at www.w3.org/TR/selectors.
The table below demonstrates some examples of CSS selectors:
||All H3 elements.|
||An element with the ID "infobox".|
||All elements with the class "nav".|
||All DIV elements and all P elements.|
||All P elements inside DIV elements.|
||All IMG elements of the "thmb" class.|
||All unvisited links.|
||All links that open in a new window.|
||All links whose src attribute value begins with "https".|
||All LI elements that are the first item in their parent elements.|
||All P elements that are located at the second position within their parent elements.|
The number of milliseconds to wait until the specified object becomes available. If Timeout is 0, the method returns immediately. If Timeout is -1, the wait time is specified by the Auto-wait timeout project setting.
The method returns an object that matches the specified search criteria.
If no matching object was found, the method will return a stub object. To determine whether the method returns a valid object, use the
Exists property of the returned object. If the property returns False, the object is a stub object.