Having problems with your account or logging in?
A lot of changes are happening in the community right now. Some may affect you. READ MORE HERE

How can I ensure the correct index tag is used for a window which can have a variable index?

How can I ensure the correct index tag is used for a window which can have a variable index?

In certain scenarios when you Record the Window Declarations you may find that an object only provides the index tag and that the index tag can be a variable value. For example in the scenario below the following tags were recorded:


[-] window DialogBox Right_Frame
[ ] tag ???1???
[-] window DialogBox Bottom_Frame
[ ] tag ???1???

However on replay the tag index for the dialog box Right_Frame can be #1 or #2 depending on if the other dialogbox box ???Bottom_Frame??? has focus. In this type of scenario you can implement the following two solutions to resolve the issue:

1) First use a unique child object to help identify the Dialog Box

What coding technique within SilkTest will allow it to uniquely identify a BrowserChild when more than one BrowserChild is using the same tag? What coding technique within SilkTest will allow it to uniquely identify a BrowserChild when more than one BrowserChild is using the same tag?

2) Then modify the Object Declaration to include a custom method ???SetActive??? which will decide which variable (either #1 or #2) is used for the index.

STRING sRightFrame = ???#1???
[-] window DialogBox Right_Frame // With Java
[ ] tag "[DialogBox]{sRightFrame}/[ListView]$5760/.."
[ ]
[-] SetActive()

//Creat our own custom method called SetActive()
[-] if this.ListView1.Exists()

//Check if unique child object (listview) exists for when sRightFrame = ???#1???
[ ] derived::SetActive()

//Call original SetActive to activate window if the unique child exists
[-] else
[ ] sRightFrame = "#2"

//If child object is not found assign alternate tag data to var sRightFrame
[-] if this.ListView1.Exists()

//Ensure that the child object (listview) exists
[ ] derived::SetActive()

//Call original SetActive to activate window if the unique child exists


If you want to ensure that the variable sRightFrame is set back to 1 after the execution of the SetActive method then use the following code instead:


[ ] STRING sRightFrame = "#1"
[-] window DialogBox Right_Frame // With Java
[ ] tag "[DialogBox]{sRightFrame}/[ListView]$5760/.."
[ ]
[-] SetActive()
[-] if this.ListView1.Exists()
[ ] derived::SetActive()
[-] else
[-] if sRightFrame == "#2"
[ ] sRightFrame = "#1"
[-] else
[ ] sRightFrame = "#2"
[-] if this.ListView1.Exists()
[ ] derived::SetActive()

Old KB# 30574

DISCLAIMER:

Some content on Community Tips & Information pages is not officially supported by Micro Focus. Please refer to our Terms of Use for more detail.
Top Contributors
Version history
Revision #:
1 of 1
Last update:
‎2013-02-15 20:48
Updated by:
 
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.