SeleniumLibrary icon indicating copy to clipboard operation
SeleniumLibrary copied to clipboard

add 'Wait Until Page Loaded' keyword

Open know1nos opened this issue 14 years ago • 10 comments

This is a useful keyword in the original SeleniumLibrary, is it possible to add it to the Selenium2Library?

know1nos avatar Sep 10 '12 15:09 know1nos

There is no need with webdriver. Wait until page load is automatic with webdriver. However it is important to note this doesn't take into account Ajax.

Cheers, Jeremy

On Sep 10, 2012, at 23:48, know1nos [email protected] wrote:

This is a useful keyword in the original SeleniumLibrary, is it possible to add it to the Selenium2Library?

— Reply to this email directly or view it on GitHub.

j1z0 avatar Sep 11 '12 01:09 j1z0

Jeremy is right, Selenium2/WebDriver is a "blocking" API so it will naturally wait until an action (like a page load) is completed. We intentionally pulled that keyword when initially writing the library for that reason.

That said, I would like to hear the context you needed it in @know1nos. I too have run into a special situation where I thought it might be useful and I'm curious if your situation is the same.

rtomac avatar Sep 19 '12 14:09 rtomac

There has not been activity for this issue for few years and we are planning to close the old issues if they are not anymore valid ones. If you feel that this is still valid issue, could you send an update. If update is not received in a month, we will assume that this is not anymore an issues and we will close this issue.

aaltat avatar Nov 05 '15 19:11 aaltat

Closed because of inactivity. If someone encounters similar or same problem please open a new issue.

aaltat avatar Dec 10 '15 20:12 aaltat

@aaltat please consider this scenario

Open Browser chrome http://url_with_some_very_slow_blocking_javascript Go To http://another.url

if the first page has some very slow blocking javascript, it will wait until the download of all of these javascript before moving to page2?

thanks

andreabisello avatar Jun 04 '18 06:06 andreabisello

As explained in the previous posts, starting from Selenium 2, Selenium provides blocking type of API. This means that Selenium will wait until page is loaded from a browser perspective. But the problem is that browser does not know what JavaScript is doing behind the scenes and therefore browser indicates too early that page loading is done. Also pages sometimes might be build in that way that whole page does not have a single state. Instead different objects in the page have their own load states. Therefore it's impossible to build a keyword which would solve everyone's, or even a small subset, problems in this matter. Instead it's better to talk to the development and find a solution for you that indicates when your page is loaded. Find a thing, which you need to poll to be sure that page is fully loaded. This is usually called testability.

But because this is problem is in the downstream and there is nothing in the SeleniumLibrary side which could be done to solve the problem, I am keeping this issue closed in the foreseen future.

aaltat avatar Jun 04 '18 06:06 aaltat

@aaltat i agree with your approch. if the website works well, there should be no long waiting time on syncronous phase of javascript. in one of my use case, i need to move on a page in order to make the login, then i need to move to another page with the session token acquired, and i don't care about the content of the "logged user" page. Robot will wait until the "logged user" page is full loaded before move to the new page by the Go To. This is not a robot issue, is a page issue. i never found this behaviour because i never found a very slow website as this one.

andreabisello avatar Jun 04 '18 07:06 andreabisello

@aaltat agree to your point and also to the fact that this is not so easy to implement. However, when automating Salesforce platform which uses heavy javascript, native salesforce objects, custom objects, lightning/VisualForce pages, pages having multiple dashboard at times - all these components take lot of time to load. Plus the loading time differs a lot. So here is where I felt dire need of this keyword. Cheers,

vish4444 avatar Mar 02 '19 16:03 vish4444

With the modern JavaScript Frameworks, there is not anymore single correct way to wait that application is ready. Instead one should look how the application is build and what kind of hook's it offers to ensure that application is ready/loaded.

Also there are already several libraries build on top of the SeleniumLibrary which may already do what you are looking for.

aaltat avatar Mar 02 '19 16:03 aaltat

At least SalesForce.org uses Robot Framework and has implemented tooling to support it (e.g. their CumulusCI supports it). They might have something to help with page loading as well.

pekkaklarck avatar Mar 02 '19 17:03 pekkaklarck