Returns the children of a window, as specified in the declaration.
lwChildren = WindowChildren (wWindow [, GUIType])
Variable | Description |
---|---|
lwChildren | The children of the window. LIST OF WINDOW. |
wWindow | The window whose children you want. WINDOW. |
GUIType | Optional: The GUI for which to return child windows. The default is the current GUI. GUITYPE. |
WindowChildren returns the child windows (from the window declaration) of the specified window on the current GUI or on GUIType, if GUIType is specified. The function also returns the window parts of the specified window, as defined in the class. For a list of window parts, see the MoveableWin class.
[-] TextField TextField [ ] locator "//TextField" [-] MenuItem AboutNotepad [ ] locator "About Notepad" [-] DialogBox AboutNotepadDialog // This window is only found if the About dialog box is open. [ ] locator "About Notepad" [-] PushButton OK [ ] locator "OK"
The entire script looks like the following:
[ ] const wDynamicMainWindow = UntitledNotepad [ ] [-] window MainWin UntitledNotepad [ ] locator "/MainWin[@caption='Untitled - Notepad']" [ ] [ ] // The working directory of the application when it is invoked [ ] const sDir = "C:\" [ ] [ ] // The command line used to invoke the application [ ] const sCmdLine = "C:\Windows\system32\notepad.exe" [ ] [ ] // The list of windows the recovery system is to leave open [ ] // const lwLeaveOpenWindows = {?} [ ] // const lsLeaveOpenLocators = {?} [-] TextField TextField [ ] locator "//TextField" [-] MenuItem AboutNotepad [ ] locator "About Notepad" [-] DialogBox AboutNotepadDialog // this won't be found [ ] locator "About Notepad" [-] PushButton OK [ ] locator "OK" [ ] [ ] [-] type WindowVerificationResult is record [ ] LIST OF WINDOW verifiedWindows [ ] LIST OF STRING newWindows [ ] LIST OF WINDOW missingWindows [ ] [ ] [-] WindowVerificationResult VerifyWindowChildren(WINDOW windowToVerify) [ ] WindowVerificationResult result [ ] LIST OF WINDOW childrenDecls = WindowChildren(windowToVerify) [ ] LIST OF WINDOW resolved [ ] WINDOW w [ ] LIST OF WINDOW missingControls [-] for each w in childrenDecls [-] do [ ] ListAppend(resolved, w.resolve({0, true})) [ ] ListAppend(result.verifiedWindows, w) [-] except [ ] ListAppend(result.missingWindows, w) [ ] [ ] LIST OF WINDOW actualChildren = windowToVerify.GetChildren() [-] for each w in actualChildren [ ] INTEGER foundIndex = ListFind(resolved, w) [-] if(foundIndex == 0) [ ] LIST OF STRING locatorParts = w.GenerateLocator() [ ] STRING part [ ] STRING combinedLocator = "" [-] for each part in locatorParts [ ] combinedLocator += part [ ] ListAppend(result.newWindows, combinedLocator) [ ] [ ] return result [ ] [ ] [-] testcase VerifyNotepad() [ ] WindowVerificationResult result = VerifyWindowChildren(UntitledNotepad) [ ] Print("Verified Windows: {result.verifiedWindows}") [ ] Print("New Windows: {result.newWindows}") [ ] Print("Missing Windows: {result.missingWindows}")
[ ] Script windowChildren.t - Passed [ ] Machine: (local) [ ] Started: 09:48:37AM on 15-Jul-2015 [ ] Elapsed: 0:00:08 [ ] Passed: 1 test (100%) [ ] Failed: 0 tests (0%) [ ] Totals: 1 test, 0 errors, 0 warnings [ ] [-] Testcase VerifyNotepad - Passed [ ] Verified Windows: {UntitledNotepad.TextField, UntitledNotepad.AboutNotepad} [ ] New Windows: {/MainWin[@caption='Untitled - Notepad']//Menu[@caption='File'], [ ] /MainWin[@caption='Untitled - Notepad']//Menu[@caption='Edit'], [ ] /MainWin[@caption='Untitled - Notepad']//Menu[@caption='Format'], [ ] /MainWin[@caption='Untitled - Notepad']//Menu[@caption='View'], [ ] /MainWin[@caption='Untitled - Notepad']//Menu[@caption='Help']} [ ] Missing Windows: {UntitledNotepad.AboutNotepadDialog}
[-] window DialogBox Find [ ] tag "Find" [ ] parent TextEditor [-] StaticText FindWhatText [ ] tag "Find What:" [-] TextField FindWhat [ ] tag "Find What:" [-] CheckBox CaseSensitive [ ] tag "Case sensitive" [-] StaticText DirectionText [ ] tag "Direction" [-] PushButton FindNext [ ] tag "Find Next" [-] PushButton Cancel [ ] tag "Cancel" [-] RadioList Direction [ ] tag "Direction" [-] main () [ ] ListPrint (WindowChildren (Find)) [ ] // this script prints: [ ] // Find.FindWhatText [ ] // Find.FindWhat [ ] // Find.CaseSensitive [ ] // Find.DirectionText [ ] // Find.FindNext [ ] // Find.Cancel [ ] // Find.Direction [ ] // Find.BottomEdge [ ] // Find.LeftEdge [ ] // Find.RightEdge [ ] // Find.TopEdge [ ] // Find.BottomLeftCorner [ ] // Find.BottomRightCorner [ ] // Find.TopLeftCorner [ ] // Find.TopRightCornerNotes