When recording and executing test cases, the Classic Agent uses the keywords
tag or
multitag in a window declaration to uniquely identify an object in the test application. The tag is the actual name, as opposed to
the identifier, which is the logical name.
When using the Open Agent, you typically use dynamic object recognition with a
Find or
FindAll function and an XPath query to locate objects in your test application. To make calls that use window declarations using
the Open Agent, you must use the keyword
locator in your window declarations. Similar to the
tag or
multitag keyword, the locator is the actual name, as opposed to the identifier, which is the logical name. This similarity facilitates
a smooth transition of legacy window declarations, which use the Classic Agent, to dynamic object recognition, which leverages
the Open Agent.
The following sections explain how to migrate the different tag types to valid locator strings.
Caption
- Classic Agent
- tag “<caption string>”
- Open Agent
- locator “//<class name>[@caption=’<caption string>’]”
Note: For convenience, you can use shortened forms for the XPath locator strings.
Silk Test Classic automatically expands the syntax to use full XPath strings when you run a script.
You can omit:
- The hierarchy separator, “.//”.
Silk Test Classic defaults to “//”.
- The class name.
Silk Test Classic defaults to the class name of the window that contains the locator.
- The surrounding square brackets of the attributes, “[ ]”.
- The “@caption=” if the XPath string refers to the caption.
Note: Classic Agent removes ellipses (…) and ampersands (&) from captions. Open Agent removes ampersands, but not ellipses.
Example
Classic Agent:
CheckBox CaseSensitive
tag “Case sensitive”
Open Agent:
CheckBox CaseSensitive
locator “//CheckBox[@caption='Case sensitive']”
Or, if using the shortened form:
CheckBox CaseSensitive
locator “Case sensitive”
Prior text
- Classic Agent
- tag “^Find What:”
- Open Agent
- locator “//<class name>[@priorlabel=’Find What:’]”
Note: Only available for Windows API-based and Java Swing applications. For other technology domains, use the
Locator Spy to find an alternative locator.
Index
- Classic Agent
- tag “#1”
- Open Agent
- Record window locators for the test application. The Classic Agent creates index values based on the position of controls,
while the Open Agent uses the controls in the order provided by the operating system. As a result, you must record window
locators to identify the current index value for controls in the test application.
Window ID
- Classic Agent
- tag “$1041”
- Open Agent
- locator “//<class name>[@windowid=’1041’]”
Location
- Classic Agent
- tag “@(57,75)”
- Open Agent
- not supported
Note: If you have location tags in your window declarations, use the
Locator Spy to find an alternative locator.
Multitag
- Classic Agent
- multitag “Case sensitive” “$1011”
- Open Agent
- locator “//CheckBox[@caption=’Case sensitive’ or @windowid=’1011’]” ‘parent’ statement
No changes needed. Multitag works the same way for the Open Agent.