Posted: 26 Sep 2018 4:26 EDT Last activity: 18 Oct 2018 3:02 EDT
Not able to identify dynamically generated buttons using GetClones method
There is a web page with multiple submit buttons. I am using GetClones method to get the collection of the buttons. 1. I need to click on each button. There is no difference in any HTML property on each of the submit buttons (I have provided the element HTML below).
3. Click of each submit button is refreshing the web page and so the clone collection is changing. So I cannot use the key property of each button to do the PerformClick.
4 The keys are changing on each refresh. If there is no way to identify the Submit buttons uniquely then we cannot click on each of the buttons.
5. The current match rule is looking at the type and value, which is same for all the four submit buttons, so all the submit buttons are matching this match rule. The buttons can be one or variable in number as they are dynamically generated, so I cannot create different controls for them.
There is no unique Element ID for each button. Please let me know how to differentiate between the buttons.
***Edited by Moderator Marissa to update SR Details***
Take attribute value match rule and use the wildcard option in that . Wildcards are either asterik(*- for big data) or ? For changing single character.
Observe the pattern of the key id for each button and change accordingly.
Thanks for your suggestions. There is no key ID assigned to the buttons, and there is no pattern for the numbers. I encountered the webpage with 2 buttons and 4 buttons. I I do not know what the pattern will be if there are 3 buttons for example. When there were 4 buttons these were the outer HTML for each of the buttons. As you can see there is no id.
I want to uniquely identify each button on each loop interaction, so that I can click on a separate button in each iteration. The above match rule is matching all the different submit buttons on the webpage, and robot is clicking the same button on each loop iteration
You can extract the unique value from the OuterHtml property of every button (clone) and use it as a unique identifier. Then you can store that value in a lookup table as a key and check if the key exist in the table before clicking on the button.
I have distinguished between the submit buttons based on the outer HTML. To click on each of the buttons, I created a control in Robotics Studio for each submit button and created an Attribute Value match rule based on the Outer HTML for each button. For our use case, the assumption for now is that there will 4 submit buttons at max.