Why does TestDrive appear to obtain random values when using the Get Screen Value action?
Well, it is not random values.
There is a reason why different values may appear than what you may expect.
A customer recently inquired about a screen with a row of data that contained the Status and a Manifest Number. The customer wondered why the value for Status was not retrieved, but rather a different screen element.
In general, as you may know, by default TestDrive will locate screen values based on
Annotation Matching. The Annotation property of the screen element in the script will be searched for on the actual screen.
However, the screen element such as Status can change.
As a result, the Annotation will no longer match with what was recorded in the script.
Based on your configuration, if Annotation matching was the only one selected, the value retrieved would be blank as it could not be found.
With some default configurations, there may also be Identifier Matching as a secondary option to fall back to locate screen elements. The numbered type of element on the screen would be utilized for matching if the annotation was not found.
e.g. If the Status was the 8th text value on the screen, then it will match the 8th text value between actual versus expected screens.
However, if you have a screen element of the same type missing prior to the intended element you want to retrieve, the matching will be off, and this is why the user may see a different value selected.
Location Matching certainly could be considered here after Annotation Matching.
However, if you have many scripts already recorded, and you do not want to change your global, option set configuration, or use an action override in the Playlist, what else can you use?
You can locate a screen element by another label.
Using the example below, presuming one row, the user wants to grab the entered order status of ENT into a Tracked Field, but the status may keep changing, hence the annotation will keep changing.
In this case, the user can use the Status label up above as the annotation.
To use the Status as the annotation, in the Playlist Editor, off to the right in Action Options, click the Advanced tab.
For Labels, locate by another label, change to Label.
And change the Positioned to Above.
Noticed it picked up Status as listed in the With Caption.
As a result, upon playback even if the status value of ENT changes to another value such
PCK for picked or SHP for shipped, the value will be found and successfully retrieved as the Status label is consistent on the screen.