What is alternative for delay activity?

I was recently asked in interview about what is alternative for adding delay activity before or after the activity. It was asked how can this be automated in some other way without delay?

1 Like

@ashwini.magar92

Some activities hold delay after and delay before in properties without using delay activity

You can give how many ms we require to wait like below

Hope this may help you

Thanks

Hi @ashwini.magar92 ,

Instead of that we use to add dynamic delay with the help of element exist activity.
This will help to wait till the element found (Default Timeout30 sec ).

Hi again @ashwini.magar92,

Technical answer: Alternative to avoid hardcoded delays is to use any of the approaches from @ermanoj3101 and @Srini84.

You can approach this type of interview question by clarifying why you avoid using any sort of delay and have minimum required timeout or delay after and before in an activity properties.

Any delay set in the robot will add up quite quickly and will consume robot execution time. Robot license is a premium when you start scaling RPA implementation. An second saved is two seconds earned.

The interviewer knows this well enough and will appreciate that you are thinking not just as a developer but as a implementation manager.

For systems where response times are erratic you can use the element exists and during testing see how the system responds and set a timeout accordingly.

Good luck!

Hey @ashwini.magar92

That’s a great thing to address.

And yes, there are number of methods to deal with this.

But if you ask me what’s the first preferred and best method…

We have two properties for activities,

  1. Wait for Ready

  2. Timeout

Wait for ready will make sure the specified action runs after a full page load or page becomes responsive or without checking page load.

Timeout is the maximum time it will try to find the target to perform the specified action on it. But it starts once the wait for ready is evaluated at runtime.

Let’s say you prefer Wait for ready as complete page load and a timeout of 30s

Now the activity does the following,

  1. It will first wait for the page to load completely

  2. Once the page load is done the timeout starts counting from 0 to 30

       2a. If the element is found within 30s of timeout (it can be on after 4secs or after 10secs or anything less than 30s) it will perform the specified action on the target
    
       2b. If the element is not found within timeout 30s then an exception is thrown
    

Why is this method most preferred ?

  • It is not going to use any of the extra activities but only the required one let’s say click or type etc.

  • No hard-coded extra delays but just a timeout may be a default one or configured by you

  • Things are pretty dynamic adapting to the application behaviour (as we first look for page load and then start the timeout)

  • The options mentioned above are inbuilt within the activities to tackle this kind of scenarios

Hope this is useful and informative.

If you still need any help please let me know.

Thanks
#nK

Thanks a lot everyone for your inputs, everything was really helpful and helped to clear my doubts.