Functional Tester supports a RootTestObject to represent a global view of the software under test. To perform a global search, you invoke the find method on the RootTestObject. Invoking a TestObject find method will only search the children of that TestObject.
The first argument in the find method is a subitem for the search properties. The second optional argument is a flag indicating whether only children that might be included in the test object map should be searched. Valid values for the property subitems are:
There are special properties that apply to RootTestObject.find, including:
Examples:
TestObject[] foundTOs ; RootTestObject root = RootTestObject.getRootTestObject() ; // Find all toplevel windows in the Windows domain with caption "My // Document" CaptionText caption = new CaptionText("My Document") ; foundTOs = root.find(atChild(".domain", "Win", ".caption", caption)) ; // Find any dialogs, then return their children // "OK" buttons. RegularExpression dialogRE = new RegularExpression("*dialog", false) ; RegularExpression buttonRE = new RegularExpression("*button", false) ; foundTOs = root.find(atList(atDescendant(".class", dialogRE), atChild(".class", buttonRE,".value", "OK"))) ; // Start Notepad, dynamically enable that process, // find its top-level window that matches the process id // and get its descendant text window. ProcessTestObject p1 = StartApp("Notepad") ; Integer pid = new Integer((int)p1.getProcessId()) ; foundTOs = root.find(atList(atProperty(".processId", pid), atDescendant(".class", ".text"))) ; // This enables a Windows app with the provided window handle and returns a // TestObject representing the window. Long hWnd = getAppsHwnd(); foundTOs = root.find(atChild(".hwnd", hWnd, ".domain", "Win")); // This enables a .NET app with the provided window handle and returns a // TestObject representing the window. Long handle = getAppsHwnd(); foundTOs = root.find(atChild("Handle", handle, ".domain", "Net"));