问题
I want to know 'How to add wait or Delay until webpage is fully loaded,' in automations anywhere, I used
wait for screen change
But it hold the process until some time specified by the developer , but I want to add delay until the web page fully loaded, Is there anyone can help me? sorry for the bad English.
回答1:
Usually, a website is "loaded" or "ready" before the actual content is loaded. Some websites even have dummy content which is replaced once the actual content is retrieved from 'somewhere'. Hence waiting for the screen to change is not a good idea.
My approach is to pick an element which you know is loaded after the element you want to interact with. For instance the navigation bar on this website is loaded before the comments are. You can either figure out which element to use by looking at the source
of the website by right-clicking anywhere and selecting view source
or by simply refreshing the page a couple of times and eye-balling it. The former requires some HTML knowledge, but is a better approach in my opinion.
Once you've identified your element, use Object Cloning
on said element and use the built-in wait
as a delay (usually set to 15 sec, depending on the website/connection). The Action
should be some random get property
(store whatever you retrieve in some dummy variable as we're not going to use it anyway).
Object Cloning
's wait function polls every so many milliseconds and once the element is found it will almost instantaneously go to the next line in the code. This is where you interact with your target element.
This way you know your target element is loaded and the code is very optimized and robust.
On a final note: It's usually a good idea to surround this with some exception handling as automating websites is prone to errors.
回答2:
A very simple solution is to run your automation while watching and determine the amount of time it takes for the webpage to load. You can add a Delay rather than a wait if you know the page is generally loaded within 30 seconds or so.
来源:https://stackoverflow.com/questions/46641179/how-to-add-wait-delay-until-web-page-is-fully-loaded-in-automation-anywhere