Hi,
I need help to find and identify screen objects whose name changes.
Specific Scenario Example
I have a screen with a Logout button. The visible text on the button is 'Logout ' plus the name of the logged on user (e.g. 'Logout Admin'). When I record the action of clicking on the button in Test Studio the script supplies a line that reads:
Click 'LogoutSpan'
or
Click 'LogoutSpan0'
or similar.
Question
How can I script so that the action works regardless of any number that may be appended to the 'LogoutSpan' part?
In fact, how can I identify anything (e.g. a 'Div') where its name or ID changes dynamically?
I thought that maybe some VB in the Code Behind window would be a solution, perhaps using a regular expression. In the case of the button I came up with:
Find.ByExpression("name=~Logout")
which I think will find any screen object with 'Logout' in its name, but got no further. I tried to write an excution line, something like:
Button.Click(Find.ByExpression("name=~Logout"))
but the type-ahead prompt in the Code Behind window didn't have 'Button.Click' as an option.
I'm not a code wizard, and don't really understand regular expressions (and yes, I've read the available on-line documentation) so I would very much appreciate some help with this. If I have a concrete example of how to resolve the above then I can build on it for the future.
Thanks,
Nigel Edwards, Transition Computing.