Do while activity it's a never ending loop for some reason

Hi, in my process I use a do while to search a specific line in a web page. I use a counter which iterates the elements, and the counter is also variable in my selectors. I have a variable who is 1 if the element was find and 0 if the element was not find. I want to stay in the do while until the element is find or when the counter reach 10 tries.

My condition looks like this:
(Elementfound<>1) OR (Counter<>10)

But the process just go on and on even the counter reaches 10.

In the do while I also have an if that verify if the elements found in the web page are those who need to be searched. So for if the condition is : ValueSupplierMeti.Equals(Supplier) AND ValueVAMeti.Equals(VA) AND ValueCugItemMeti.Equals(CugItem).

The first time it worked the element was find with first group of data, the next time he just run forever.

Also I tested the selectors and they work fine, they see all the data.

@adrianab.98

Please try with this condition

Elementfound.Equals(0) or Counter<=10

Alternately in do while you will have a max iteration property which can be used instead of counter

Cheers

Hello @adrianab.98
You can pass the maximum iteration in Do while Properties
and Use the desired Condition in Do while

Elementfound<>1     ---> If the Element Found is 1 the loop will stop

I don’t have that property.

But I managed to resolve this by putting another if condition to the else branch. If Counter>10 then Articolfound to become 1. so in the do while exit condition will be just “Aricolfound.Equals(0)”. I don’t know why it doesn’t work with two conditions in do while condition field

@adrianab.98
Try to place the id condition in the do while loop with Counte>10, then use the Break activity. It will break the Loop.

@adrianab.98

It works with two…

But the problem here is condition we are using is not 1 or not max loop

So say when the iteration is 10 and wlement is not found thwn true or false will give true …so the loop continues

To break the loop the condition should be as follow

Element.equals(0) And counter <= 10

This would break the loop if counter crosses 10 or the element is found…

Or condition will give true in other cases as well

Hope this clears you question

Cheers

Oh… right.

Thank you

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.