|TestObj||A variable, parameter or expression that specifies a reference to one of the objects listed in the Applies To section|
|Result||An array of the tested objects.|
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 parameter:
A string containing one or more CSS selectors separated by commas.
The table below demonstrates some examples of CSS selectors which you can pass to the
QuerySelectorAll method in order to search for the desired web page elements.
||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.|
An array of the objects that match the specified selector(s).
|Tip:||To search for an individual element, use the
If a TestComplete web object matches the specified selector, then the array item contains this object.
If there is no matching TestComplete test object, the array item holds the appropriate HTML object.
If neither matching test objects, nor HTML objects were found, the method returns an empty array.
toArray() method of the variant array:
JScript, C#Script, C++Script
var JScript_Array = Variant_Array.toArray()
When the method is called for
Pageobjects, it searches the entire web page. If it is called for a particular web page element, then it searches within the children of that element. When the method is called for the
UIPageobject or its child objects, the search is performed within the UI controls.
The search is performed within the current web page. If the tested web page contains HTML frames displaying other web pages, then to search for the desired element within a frame, you should call
If the selector string contains a CSS pseudo-element (
::selection), the method returns an empty array.
To view the example that demonstrates how you can use the
QuerySelectorAll method to search for a web page elements, see Finding Web Objects Using CSS Selectors.
QuerySelector Method (Page Objects)
Classic Web Testing
Find Web Objects
NativeWebObject.Find Method (Page Objects)
EvaluateXPath Method (Page Objects)