This is a migrated thread and some comments may be shown as answers.

Dynamic Button ID

1 Answer 84 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Maxwell
Top achievements
Rank 1
Maxwell asked on 23 May 2017, 06:18 PM

Hello, 

I have been trying to get a workflow to work, but it isn't able to find a button element because its id gets changed to a random assortment of strings each time you navigate to the page.  I have tried to edit the way it searched for the HTML, but I have had no progress.  Maybe I am doing something wrong?

Also, the button is in some sort of alert dialogue, but the test studio doesn't recognize it as an alert dialogue ( I tried the 'handle dialogue' step ).

 

Anyway, any insight would be greatly appreciated.

 

Thank you,

 

Max G

1 Answer, 1 is accepted

Sort by
0
Ivaylo
Telerik team
answered on 26 May 2017, 08:21 AM
Hello Max,

This is expected behavior when you have an element with dynamic ID. In such cases you have a few options to proceed. 

You can try finding a parent element or a sibling element with unique attribute and try locating the button based on that element. You can used the so called chained find logic. More information you can find using this article.

If the approach above doesn't work you can use blind mouse click in order to press the button. Please note that the proper work of the blind mouse click can be dependent on the resolution. Thus if you are executing your test on multiple machines the behavior may be inconsistent. 

Lastly, if the button is focused/active at the moment the dialog appears you can use a coded step to pres Enter for example and see whether this works. Here is an article about how to use keyboard strokes.

Regards,
Ivaylo
Progress Telerik
 
The New Release of Telerik Test Studio Is Here! Download, install,
and send us your feedback!
Tags
General Discussions
Asked by
Maxwell
Top achievements
Rank 1
Answers by
Ivaylo
Telerik team
Share this question
or