Konw whether the browser has finished loading or not?

browser

#1

Hello people, I’m asking how to know whether the browser has finished loading or not ??


#2

Hi @Hazem,

You can use “Find Element” or “Element Exists” or “On Element Appear” activity with appropriate value in TimeoutMS property.

Regards
Vitan


#3

This will happen by default with web UI Automation activities that have WAIT_FOR_READY = Complete. They will execute only after the web page has been fully loaded.


#4

@badita @Vitan Thanks for your helpful reply,but actually when the browser has been fully loaded,there could be 2 things,either the browser navigated to the URL correctly (meaning internet is working) or the browser failed to connect (meaning no internet connection)…so I want just to know if the browser is fully loaded or not <<then use element exist with very small timeout to determine whether the browser navigated correctly to the site or not ??


How can i check if a web page is loaded successfully
#5

Doesn’t ElementExists with WAIT_FOR_READY=Complete and a longer timeout (default is 3 secs) work?


#6

@badita so if I used the element exists activity with WAIT_FOR_READY=Complete .It will wait till the page is fully loaded whatever the timeout was ?


#7

Yes. Not sure what happens if redirects are involved but test it.


#8

@badita It didn’t work,the activity didn’t wait till the page is fully loaded and processed to the next step after the timeout if finished


#9

Have you increased the TimeoutMS from 3000ms?


#10

ElementExists returns a true/false - if it doesn’t find the element in the timeout, it will return false. You need to check it’s result after, f.e. in an If.

If you want to wait indefinitely, just set a really high timeout or set a `While(Not myElementExists) { ElementExists(…) }. Or a retry scope might be good for you as well.


#11

@andrzej.kniola Actually if did increase the timeout to the average time the page takes to load then I may increased it to over a Minuit .
while the the browser actually has failed to navigate to the page !! so it will search for an element that will never be existed


#12

Increase it to over a minute. If the element is found sooner it will continue without waiting.


#13

Yes,I know,but If I did that the activity will take the whole period to decide that the element isn’t existed and that’s would be much time to wait !! . I believe your solution is good but it’ll takes too much time !
and thanks in advance @badita


#14

It won’t. [quote=“badita, post:12, topic:5820”]
If the element is found sooner it will continue without waiting.
[/quote]

But try it.


Extract Content from various news using Screen Scraping Function
#15

I ran in to a similar problem, and the only workaround I found was to add a “Get attribute” activity after the “navigate to” one.

The “Get attribute” activity has “” as a selector, and “readystate” as the attribute name. This will cause the process to wait for the page to load.


#16

@bogdanripa

Could you put your selector from the previous post into a code snippet? HTML tags get sanitized on the forum and I would really like to see that selector :slight_smile: