Click is not working when the workflow is triggered next time inside a for loop

Hi All

I have a workflow inside a for loop. In the workflow every time it needs to click on an element. But the bot is clicking on that element in the first iteration only and then performing subsequent actions in it. But from the next iteration onwards it doesn’t click on that element.

When the workflow was not created and everything was inside a single workflow the click was happening properly inside the for loop for each iterations.

@kkp

Check IS the element is changing when the next loop runs, Also if you are using any dynamic selector then validate that too

Hope this helps

Thanks

No that element is not changing. And also i am not using any dynamic selector. As i said with the same element and selector it used to work when everything was inside one workflow. Why is it creating issue after creating different workflow ?

For the repetitive part after clicking that element i have created the separate workflow and placed inside the for loop.

@kkp

OK, you can try by giving few delay before, also try to debug and go step into to get the issue

Hope this may helps you

Thanks

I debugged and ran by clicking Step Into. Thing is its just passing the click activity without clicking and without throwing any error to the next activity.

And in the next activity its throwing error as its not getting the required element due to the above issue.

So I am clueless why its happening like this ?

@kkp

IF that is the suspect then you can make the activity properties → ContinueonError to “False” This will get you know that is it failing because of that activitiy

Hope this helps

Thanks

Its by default False only. And thing is its not clicking in the Click activity and passing to the next activity.
My question is why the click activity is not clicking on the specified element?

@kkp

Can you share the selector and the element screen?

Also for share me the Click activity properties too

Thanks

I am facing the same issue, any resolution yet?

Could anyone please comment, I am facing the same issue. The click activity works only for first iteration in foreach loop.

“It doesn’t work” doesn’t give us any information we can use to help you. Show us your code. Show us what you’re doing. Explain the desired result.

@postwick Thanks for replying. I want to attach two files from different locations on a web page. I stored the location of two files in a string array. I want to attach these two files in a loop by clicking on attach button on web page. After clicking on attach, window pops up to select the file and then it is attached.

The problem is, I can attach first file successfully but on second iteration, the click activity just pass by without giving me any error and there is no click on attach button on browser.

The screenshots of workflow and selector properties of click activity are attached.


Capture2
Capture3

UiPath felt it necessary to put the idx attribute into your selector. This means the other attributes didn’t make the selector unique enough. Then you put a * in the idx attribute, which is the same as just removing this attribute. You need to find a way to make that selector unique without the idx attribute, or leave the idx attribute but fill it in with a real value.

Thanks for replying. You are right. The problem is, on first click, I get no index attribute in selector but if I check manually the value of selector on second click, it gives me index value 2.
I am trying to make it unique but I have no other option available.

This is how the UIexplorer of click activity looks like.

Any idea how to make it unique based on the available attributes in selector?

name and id are good options, if they don’t change. Show us the page these elements are on. Is there more than one button and you have to loop through to click them?

The page looks like this:
Capture6

I called “Search” button as “Attach” button in my first message so please don’t confuse with it.
The first click on Search button works but there is no click in second iteration. The other clickable button on this page are “Add”, “Further” and “Back”.

I highly appreciate your help in this regard.

The problem was solved. I just introduces a variable which initialize with zero and increment one in the next iteration and that’s how the UI element in second iteration differentiated from the UI element in first iteration.

hi …I m getting the same issue ,can u help me with that please?