Dynamic Button ID

2 posts, 0 answers
  1. Maxwell
    Maxwell avatar
    8 posts
    Member since:
    Nov 2016

    Posted 23 May 2017 Link to this post

    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

  2. Ivaylo
    Admin
    Ivaylo avatar
    782 posts

    Posted 26 May 2017 Link to this post

    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!
Back to Top