How do I wait for the Browser to finish loading the page

The browser must know when the page is loading and when it’s finished loading as it displays spinning circle wait indicator. Does UiPath have any way of reliably knowing the page is loaded completely? I’m running reports prior to archiving data in an important system. I need to generate 200,000+ of these reports. This report requires date filters to be added and then you click the view button. Once the report is there I click the download to PDF button. The issue is the download to PDF button is always there whether or not a report is loaded. If I click the download pdf button too early I get a blank report. I added a delay to account for this, but I found sometimes my delay is too short based on the size of the report or system performance. I could “Just” increase the delay but as it is this job is likely to take almost a month to run. I hate to waste any time on extra delays, but I have no way to check all of this output to find and rerun the blank reports. Once the system is purged game over for this data. I can’t test for an element to appear in the report as the reports are totally dynamic and there is nothing consistent to test for. Any best practice to know the page is loaded?

Thanks!

You should be able to get a selector for this “turning circle” and use the usual function to wait until an element disappear:

@rogerfries
we do a proper sync, as using any delay constructs are not reliable.

following approaches can help:

  • retry scope
  • creating a custom retry scope flow
  • reacting on loading spinner

for last option often the spinner is set in its visibility to none (no display) by css property. Ofte it is not set on loading spinner image directly, but on some parent div. Catching the CSS Property value we can do with following activity:

@rogerfries,

You can also use Element Exists activity that will look for specified element until ui element is not visible

Cheers,
Pankaj

Right now the system is running very fast and I can not manage to indicate the loading spinner as I can’t seem to click fast enough the indicate on screen and get back to the spinner in time. Is there any hotkey or other trick to detect an element quickly? Thanks!

@rogerfries,

oh okay.

what i can say now :smiley: .
keeping on trying and i guess ui element must be stable and visible until it gets selected.

catching the loading spinner can be done with differen strategies:

  • seaching for image urls / classes / names / ids within the source code (often we do find it under names containing spinner)
  • usin webtools and recording network activity (as it is a loaded image, we can find it in the list)
  • on a heavy case we did it by blocking / breakpoint setting javascripts and were able to stop while displaying the loading spinner

In the end I solved this by using a reasonable delay then testing the downloaded file size. In my case if the file size is over 65K it should be a good file. The small file is running now 10,568 records @ 30 seconds each will take about 88 hours of execution time.

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