AnyWin.
Returns the names of the children of the window declaration for the Classic Agent or the handles of the children of the window in the UI for the Open Agent.
lwChildWins = window.GetChildren ([bInvisible, bNoTopLevel])
Variable | Description |
---|---|
lwChildWins |
|
bInvisible | Optional: If TRUE, also returns invisible windows. For the Classic Agent, this is set to FALSE by default. The Open Agent always uses FALSE for this value regardless of what is specified in the script. BOOLEAN. |
bNoTopLevel | Optional:If TRUE, does not return windows of class MainWin, ChildWin, or BrowserChild. This is set to FALSE by default. The Open Agent always uses FALSE for this value regardless of what is specified in the script. BOOLEAN. |
[-] 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}