Hello, I have a workflow where some pages often have variable loading times, it might load instantly, or it might take 10-15 seconds or longer to load. If it doesn’t load on time the element on the page is not found so I put a delay but it is still not good enough, so I wanted to know if there is any way to just tell the robot to wait until the page is done loading and then take the next action?
There is no way, to know when a page is loaded.
most browser has an “loaded” event, that is based on when the entire website has been fetched, rendered and the linked css/js files has been gotten, but most websites now a day, then run javascript that needs to initialize, most likely talks to an api etc. so that is not an good indicator ( you can use WaitForReady on get element, to wait searching until the browser has set loaded to true )
That is why, the recommended way on most RPA solutions is to search for some element that is only visible when the page is fully loaded.
This might also be an issue on certain pages, there are many many ways you can create or hide an element, so if the element always exists and is not hidden with “common” ways like setting display: none or z index, or size that will always return an element.
An alternative approach is doing the opposite, searching for something that is only present while loading ( like a loading image ) and then use WaitForVanish not continue until this has been removed and/or is no longer visible in browser.
Selenium/puppeteer has a cool alternative where they monitor for tractic on the tab, and only when the tab has stopped talking on the network will it continue. OpenRPA’s browser extension does not support that ( I’m unsure if that is even possible with all the restriction chrome/google is enforcing with manifest v2 and soon v3 )
So, not sure why you think that is not good. That is, the way everyone is doing it in all rpa solutions ( except those that might support the monitor network trick ) but if you have suggestions on a better way, I’m open to hear them.
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.