How to write a while/dowhile loop condition?

I have such scenario, please see the picture.


If the Phase is not “completed”, then click the button “Refresh Data”, after 5 seconds, Check the Phase again, if the phase is not “completed”, click the button “Refresh Data” again, until Phase is becoming to “completed”. When Phase is “completed”, click “View Output”.
I’m writing like this:

However, when I run the robot, it will keep clicking “Refresh Data” and cannot jump out of the loop.

I think I didn’t really get how to use loop with conditions. Will someone help to check where the problem is for the logic? I think the new phase status that “Get text” get is not passed to the condition.

Thanks in advance!

Hi @ashley.ly.liu

instead of Do while you can try with Retry Scope activity

and in condition block use element exists.

Regards,
Shivam

Hi @ashley.ly.liu

Did u tried like this in do while loop condition

phase.ToString.Trim<>“Completed”

Or in another way u had to do.it

Use while loop

Inside it use Element exist activitiy to check whether the Phase is Running and store in varaible phase

Then use if Condition with condition as phase

If it is true

It implies that phase is running so in then section use click activitiy to click the refresh Data

If it is false

Then it implies phase is completed then in else section use click activity to click the View Output option and then use break activitiy to exit out of loop

Hope it helps you

Regards

Nived N :robot:

Happy Automation :relaxed::relaxed::relaxed:

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