Dynamic Website Textbox elements

Hello,

Just want to check any suggestions on what action in UI Path that fit in this scenario.

Upon checking the elements of textboxes on the website, the id is incremented like prefcode1, prefcode2, prefcode3, prefcode4, prefcode5, so on and so forth.

How I will be able to determine all those textboxes using a loop since it is just incremented and has the same keyword element.

Thank you for your time.

Hey, Assuming it’s a website ….. can you try Data scraping and check if all the text box’s are getting scrapped. String manipulation can be used later to get the number of text boxes if it gets scrapped correctly. let me k kw how it goes :wink:

1 Like

@Eleeenggg

Welcome to the community

For each ui element can be used in the first place

or else even find element with filter on class with * also would work

or use a variable in selector <webctrl tag='DIV' class='prefcode{{variable}}' />

cheers

1 Like

Hi @Eleeenggg

You can consider below approach:

  1. use a do while where inside do block, you will use element exists to first check if element with id exists. While condition would be when next element doesn’t exist
  2. before do while , define a counter variable with value, inside do while, use it in element selector. Define id = ‘prefcode{{counter}}’
  3. first time do while loop runs, prefcode1 element will be checked if exists, then do your steps with the text box
  4. increment the counter by 1
  5. element exists condition under while will be with this new counter value. So basically we are checking if next text box exists, if yes, then only perform next steps else exit the loop

Regards
Sonali

Please use dynamic selector with utilization of variable