How to write condition in IF statement to check whether Timespan is more than 30 seonds

Part of a Workflow that I am building needs to measure the time elapsed between two the opening of a Webpage and the appearance of Ui Element on the page. I have made use of the Stopwatch object in VB.NET to measure the time that has elapsed between two time intervals. From the Stopwatch object I have obtained TimeSpan value. My question is how do I compare the TimeSpan value with a set value.
I am required to do certain actions if the time spent between opening of the Webpage and the appearance of Ui Element on the page is more than 30 seconds

But how do I write a boolean expression something like

Timespan > 30 seconds into the condition of the IF activity? I tried doing the following but it shows an error

Kindly assist. Thank you.

Hi @RobinsonFrancis,

You can use this.


Can’t you get around this using element exist? If you leave the timeout field as default, after 30 seconds the boolen will be false and you can use



declare 2 datetime variables

assign startTime = Now after browser open

assign endTime = Now after element is found

now you can check the time elapsed using

1 Like


It might be better to use StopWatch.ElapsedMilliseconds instead of StopWatch.Elapsed. Because this returns int64 value and we can easily write the condition as the following.


Thanks @muhammedyuzuak, @Yoichi and @jack.chan I have tried all your suggestions. They are really good suggestions.

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