While loop for 4 hours

How to make a while loop to run for 4 hours

1 Like

Hi @Sirisha_Siri ,

Can you elaborate your scenario, is there any condition that you are checking in while loop?

Regards,
Rajeswari

1 Like

i need to check for 3 elements. I used find element activities and indicated three elements. it has to check for 4 hours.

1 Like

you could set the time now in a variable e.g. time.now and then do while time.now.addhours(4) is greater than the time now

what should be the datatype for this variable

you could use it as date.time or as a string and compare the strings


it is displaying date as well

Hello @Sirisha_Siri Follow These steps.
1.Take one Assign activity with Datetime Variable And Pass Value
DateTime.Now.AddHours(4)
2.Take one while loop with Following Condition
DateTime.now.ToString<=DTime.ToString
Where DTime is my DateTime Variable.

Regards,
Saloni

You could do time.now.replace(date.today.tostring("dd/MM/yyyy ",string.empty) to just get the time

Screenshot (25)
getting error

how to remove date here. it is displaying date as well

Assign → DateTime.Now.AddHours(4).Tostring(“hh:mm:ss”)
Loop → DateTime.now.ToString(“hh:mm:ss”)<=DTime.ToString

It will only Compare Time.


should we declare varialble as string?

Yes, Sorry forgot to Let you know.
You have to convert variable to String.

thankyou will try it out

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