How to handle changing elements?

1 Answer 117 Views
Elements
Kevin
Top achievements
Rank 1
Kevin asked on 06 Aug 2021, 04:57 PM

Hello,

 

I am trying to edit the find logic for an element that changes every time you click the button. For Example, the field changes from CreatePurchReq1_New0 to CreatePurchReq2_New. I tried editing the element to 'Starts With' 'CreatePurchReq' but can't do 'Ends with' because the number at the end changes too, and the CreatePurchReq ID is also used elsewhere on the page so it is not specific enough. 

Is there a way to use wildcards like in SQL? Not sure on the best way to proceed.

1 Answer, 1 is accepted

Sort by
0
Elena
Telerik team
answered on 09 Aug 2021, 12:45 PM

Hello Kevin,

As far as I understand you are using partial match for text content attribute to identify the element on page, but this is not sufficient for unique identification of the button. 

Then, you might need to use a set of attributes to point to that single element on the page. You mentioned that the id attribute is used for other elements as well, but to these have also the same text content?

Is it possible to combine the text content and id, with tag name attribute for example, and this way point the find expression to a single element?

Did you have the chance already to review the article how to handle dynamic elements? Have you tried any of the suggestions listed in it? 

In case these suggestions still do not help you, please, collect the DOM tree of the page (you can use the Visual Debugger tool options to pause the test and collect the DOM tree) or export step failure details and send these zipped via this thread. 

I hope this information is helpful for you. Let me know if you need further assistance.

Regards,
Elena
Progress Telerik

The Test Studio R2 2021 release is out now! Register for the live release webinar on August 26 at 11 am ET | 5 pm CET and be among the first to get a preview of the fully revamped Step Failure Details in Test Studio.
Tags
Elements
Asked by
Kevin
Top achievements
Rank 1
Answers by
Elena
Telerik team
Share this question
or