Boolen to int conversion

studio

#1

i want to use boolean as condition to incriment the dowhile loop is it possible ?


#2

existss is either true or false so you don’t need “=true”

I also don’t understand your question. If you want to use it to loop your Do While, then you can do so how you are currently by putting the boolean in the condition of the Do While.

Do
    
    Element Exists
While existss

It will loop until the element is no longer on the screen.


#3

hey hi clayton, i want to repeat the next button click action until the element exist gives true value , so i want a loop for this could you please explain me how to do this?, thank you


#4

Hi.

If you want to loop until the element exists, then you want the opposite. So, it reads as Do While exissts is false
You just need to use “not” infront to make it the opposite of true, like not existss

Do

While not existss

Regards


#5

It’s best practice to put a limit on the number of loops the robot will attempt, otherwise it will get stuck in the loop forever. For this you could have an integer variable, assign it as 0 before you enter the do while loop, and then in the body of the do while insert an assign which increases the integer variable by 1 each time. Something like;

IntegerVar = IntegerVar+1

In the condition of your do while you would then add where IntegerVar is less than, say, 5.

existss=FALSE AND IntegerVar<5

Remember that your condition of the do while should be TRUE for it to loop, otherwise the robot will continue with the workflow. If existss=true (so your element exists) or the counter gets to 5, it will continue. You could then check once more if your element exists, and if not, throw an error. :slight_smile:


#6

@KEntwistle Good point! Retry Scope is a good approach to avoid infinite loops as well; you can use the Element Exists (since it returns a boolean) in the condition spot of the Retry Scope.