Highlighted
Ben_Langton Absent Member.
Absent Member.
1618 views

WindowChildren() returns nothing in SilkTest 13.5, but WindowParent() works

Jump to solution

I am using SilkTest 13.5, with OpenAgent.  I am trying to write a function that will generate some information about my Window Declarations, so that I can explain them to colleagues.  The function WindowChildren() is supposed to return a list of the windows which are declared as children of the specified window.  This function is based on the Window Declarations; it is entirely independent of the application under test.  It returns nothing.  WindowParent() is the reverse; it returns the declared parent of the specified window.  WindowParent() seems to be working.

I didn't see any indication that WindowChildren() is deprecated; is this a bug?  Does anyone know of an alternate way to interact programmatically with my window declarations, when using Open Agent?

Thanks,

Ben Langton

0 Likes
1 Solution

Accepted Solutions
Micro Focus Frequent Contributor
Micro Focus Frequent Contributor

RE: WindowChildren() returns nothing in SilkTest 13.5, but WindowParent() works

Jump to solution

Although not explicitly stated in the Help documentation; the WindowChildren function was designed to work with Classic Agent Window Declarations only, and will not return anything if the frame file contains only Open Agent Locators.

There is no equivalent Open Agent function to search the frame file, and return a list of children of a specified window. The best solution I can offer; is to use a function like to one below to interrogate the application, returning all children of the specified window and their Locators:

[-]  GetWindowsAndClasses (WINDOW wWindow)

[ ]

[ ] LIST OF WINDOW lwWndList

[ ] WINDOW wTemp

[ ]

[ ] lwWndList = wWindow.FindAll("//*")

[ ]

[ ] print("------List of Child Object Name and Locator Strings -----")

[ ] print(" ")

[ ]

[-] for each wTemp in lwWndList

[ ] print("Class Name = {wTemp.GetClass()}")

[ ] print("Locator Name = {wTemp.GenerateLocator()}")

[ ] print(" ")

[ ]

This can be called from a Script as follows:

[-] testcase Test1 () appstate none

[ ]

[ ] GetWindowsAndClasses(WindowName)

0 Likes
2 Replies
Micro Focus Frequent Contributor
Micro Focus Frequent Contributor

RE: WindowChildren() returns nothing in SilkTest 13.5, but WindowParent() works

Jump to solution

Although not explicitly stated in the Help documentation; the WindowChildren function was designed to work with Classic Agent Window Declarations only, and will not return anything if the frame file contains only Open Agent Locators.

There is no equivalent Open Agent function to search the frame file, and return a list of children of a specified window. The best solution I can offer; is to use a function like to one below to interrogate the application, returning all children of the specified window and their Locators:

[-]  GetWindowsAndClasses (WINDOW wWindow)

[ ]

[ ] LIST OF WINDOW lwWndList

[ ] WINDOW wTemp

[ ]

[ ] lwWndList = wWindow.FindAll("//*")

[ ]

[ ] print("------List of Child Object Name and Locator Strings -----")

[ ] print(" ")

[ ]

[-] for each wTemp in lwWndList

[ ] print("Class Name = {wTemp.GetClass()}")

[ ] print("Locator Name = {wTemp.GenerateLocator()}")

[ ] print(" ")

[ ]

This can be called from a Script as follows:

[-] testcase Test1 () appstate none

[ ]

[ ] GetWindowsAndClasses(WindowName)

0 Likes
Ben_Langton Absent Member.
Absent Member.

RE: WindowChildren() returns nothing in SilkTest 13.5, but WindowParent() works

Jump to solution

Thank you, JohnM.  BTW, I forgot to mention that the AUT is a web application.

Primarily, I was looking for a way to summarize the declared window hierarchy.  My window declarations (frame file) are nearing 10,000 lines with all the custom methods and such.  I now have some people who are totally unfamiliar with my code helping me catch up on my backlog.  They have no good way to look at the AUT, and find the name of a particular control in the window declarations.  

I found yesterday that one of my windows actually did return one child when I called WindowChildren().  It was a declaration for Internet Explorer, with a child, declared as class Control, representing the right click context menu.  There were other children declared, as well, but I think they were all xBrowser classes, so apparently, WindowChildren() ignores them.

Perhaps I will write a PowerShell script to parse the frame file with RegEx and build a window hierarchy in a separate file, or maybe look into 3rd party tools like DOxygen.

Thanks,

Ben Langton

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.