How to use Anchor Base with For Each or other looping activity

Hi,

I need some help with the workflow. Here is what I want to do:
→ I have a webpage that has table embedded and I need to find and Click elements under a certain column, let’s call it “Ticket Col”. If rows under “Ticket Col” are empty my looping activity (For Each) should continue. If some tickets are found, then it should click that ticket element and continue to perform a set of actions.
My challenge: I have tried a few things out and Anchor Base activity seems like the best way to find the anchor element “Ticket Col” and click the UI ticket element under it. Now, I want to do this in the form of a loop similar to a for each. So how to mix an Anchor Base and a For Each/For Each Row activity effectively here.

P.S.: Sorry if this has been asked already, I searched in the forum and I couldn’t find anything relevant to my issue.

1 Like

There must be an idx or row/column to iterate over in order to put this into a loop. If you have either of these attributes, you can use a While loop to iterate over the data.

1 Like

@Anthony_Humphries every item has column attributes like " tag=‘A’ tableCol=‘1’ tableRow=‘2’ ". I know how to iterate through excel col and rows, but which activities would allow me to do the following in a webpage:

  1. identify if there is anything under Col1
  2. if there is anything under Col1, Click each element under Col1 and conitnue with a set of actions
1 Like

If your goal is to click the images to redirect to a different webpage, you won’t need the datatable (unless you need information from the table for next process steps).

So your While loop would see if the element exists, and if it does not, break from the loop. Otherwise, click on that element to navigate to it.

1 Like

You’re right. I don’t need the datatable.
However, If I use a While loop, I would have to set the condition to: while var_under_TicketCol isnotempy continue to click each element under TicketCol. So, how does it know if there is a value in row1,2,3 etc…? var_under_TicketCol would then to need to iterate. And that’s what I’ve had difficulty doing, which is why I tried to do a ForEach in a datatable to know if var_under_TicketCol is empty or not…I hope I’m making sense.

1 Like

Use the Element Exists activity to check if the selector is valid as you iterate. Once it is not, exit the loop.

1 Like