Skip to Content
Technical Articles
Author's profile photo Mohamed Yassine LAZRAK

SAP IRPA 2.0: How to wait on page taking too much time to load with cloud studio

Hi

I am writing this blog post to give a feedback and share my experience on SAP IRPA V2 and solutions for the challenges I got on my projects.
On this blog post, I share with you the technical steps how to wait on page taking too much time to load..

You surely noticed that the function “wait” on screen for the cloud studio does not have a parameter to set / change the default timeout (by the way this will be released in the future version).

In my use case, the bot needs to connect to a web site to login and choose an application from the menu, the issue is the SSO mechanism take too long to authenticate on the chosen application as consequence the bot fail because of “wait page timeout”.

I tried to many things for example:

  • Using the activity “forever” and testing on the screen “exist”, it didn’t work and with test mode on the time line I could see the page load event but the bot continue looping.
  • Also, I tried using the delay parameter of the function “wait” on screen but it was not very relevant, sometimes the delay was too high and other too short.

Hence I needed a better solution so the bot execute the expected activities as soon as the page is loaded.

Find below the solution that worked for me.

Technical steps:

 

 

Just to explain the flow, once the bot had chosen the application from the menu on the screen ‘pChorusPro’, he must wait too long until the page ‘pHomeS1’ get loaded.

Please note that you need to add a custom script in the page activity.

 

var loop = true;

$.chorus.screens.pHomeS1.events.LOAD.on(function (ev) {
    loop = false;
    // Add the expected activities to be achieved by the bot
});

while(loop){
    await irpa_core.core.waitTime();
}

irpa_core.core.log('pHomeS1 loop end', irpa_core.enums.logType.Info,'afterLoop');

 

How it works:

  • Declare a Boolean variable with a scope for all the script
  • Add a call back function for the load event so the bot will be listening on this event.
  • Add a while loop so the bot stack on this step

The bot will loop until the page get loaded, at this time, the “load” events will be triggered and the call back function will be executed. This function will set the Boolean variable to false as consequence we will break the loop.

 

To sum up:

In this blog post we saw how to wait on a page that takes too much time to load

Hope this blog post helped you to solve your challenge. I will be very happy to read your comments or feedback either for improving my suggestion or introduce other challenging aspects.

Assigned Tags

      Be the first to leave a comment
      You must be Logged on to comment or reply to a post.