Help creating a click loop

Hello,

I’m new to UiPath.

I have created a recording that clicks on a name on the website data table, I want to click on the name on row 1, which then displays further information which i then click though( I have these steps already) and then row 2 and so on.So do I need a for each loop? Can anyone help me get started please?
The selector reads in the first click


2nd click


Thanks
Ross

Hi @rosscortb,
I would suggest comparing your selector for the first row with the ones for the following rows. If it contains e.g. “1”, “2”, and the next ones contain simply the following numbers, then you can solve it with placing the process in a loop - like For Each or Do While, and add a counter. To create a counter you would use within Assign: counter = counter +1, where ideally “counter” variable would be an integer. Then you need to replace your changing part of the selector with that “+counter.ToString+” - I would suggest to amend your selector via “Expression Editor” -“…” next to the selector field. In case the counter (and your first selector) starts from some higher number - e.g. “3”, you would need to assign this higher value first to it, before you put it again within “For each” scope. Then each loop will simply increase the counter and change the selector. Here is some example - does it solve your issue? :slight_smile:


https://studio.uipath.com/docs/the-do-while-activity
https://studio.uipath.com/docs/the-while-activity

Hi Pad,
Thanks for getting back to me. I used your advice and also tried a little of the ‘How to use a variable…’ link that was posted also.
I am getting stuck though. I was hoping you look at the screen shots to see where i am going wrong please?
The first screenshot is me when i use the mouse click and on row 204, I believe that variable should be after the aaname? plus 1
The screenshot is me trying to use the expression selector method now and the third screen shot is the error.



ss3

Hey @rosscortb

Try increment the counter
For this I would suggest you to use flowchart

Regards,
Pavan H

Hi Pavan

I changed the counter from sequence to workflow but still get same error.

in the log it reads
An ExceptionDetail, likely created by IncludeExceptionDetailInFaults=true, whose value is:
UiPath.Core.InvalidSelectorException: The selector is not valid ----> System.Xml.XmlException: ‘205parentid’ is an unexpected token. The expected token is ‘"’ or ‘’'. Line 1, position 123.
Thanks
Ross

Hi @rosscortb
In the selector after aaname= ‘“+counter.tostring+”’
This should work, in your selector you missed the single quote which is there for ‘204’ plz use the above one and try

Let us know if this works,
Regards,
Pavan H

1 Like

Hi Pavan,
Thanks for your help so far.
Did what you said now and now get an error, thanks Ross
An ExceptionDetail, likely created by IncludeExceptionDetailInFaults=true, whose value is:
UiPath.Core.InvalidSelectorException: The selector is not valid ----> System.Xml.XmlException: ‘‘’ is an unexpected token. The expected token is ‘"’ or ‘’'. Line 1, position 124.
at System.Xml.XmlTextReaderImpl.Throw(Exception e)

Hi @rosscortb,

Try the below work flow and apply the same logic , this might help you,

Does this solve the issue?

Sample (2).xaml (13.5 KB)

Regards,
pavan H

1 Like

Hi Pavan,

Sorry to be a pain, can you attach again, please? The link isn’t working
Thanks

Ross

1 Like

Hi @rosscortb,

here it is: Sample (2).xaml (13.5 KB)

Hi Pavan,

I managed to get it work by copying the quotation marks in the error log and paste in and some how that worked. So it’s clicking on the right place, I’ll now try and work out the loop as at the moment its clicking in the same place, over and over. Cheers
Ross

2 Likes

Hi rosscortb,

You see img.
image