Skip to content
This repository has been archived by the owner on May 30, 2023. It is now read-only.

Provide utility "loading" booleans on WebPage object #11091

Closed
detro opened this issue Feb 23, 2013 · 5 comments
Closed

Provide utility "loading" booleans on WebPage object #11091

detro opened this issue Feb 23, 2013 · 5 comments
Milestone

Comments

@detro
Copy link
Collaborator

detro commented Feb 23, 2013

[email protected] commented:

It would be useful if the WebPage object would provide an easy way to detect if a page is loading or not.

While that is obviously done using "loadStarted" and "loadFinished" event handling, it still something surprisingly we don't provide directly as API.

Also, what about the "progress"? We have no way to report about "how far is the page from being fully loaded".

I propose 2 properties:

  • [bool] page.loading
  • [int (between 0 and 100)] page.loadingProgress

Also, this feature will help to implement better the "wait for page load on click" in GhostDriver: currently the implementation depends on the "loadStarted" and "loadFinished" but complex scenarios, when only a FRAME or a new PAGE are loading are quite tricky to implement and monitor.
This could make for an easy way to recursively report if any of the frames or pages is loading or not.

Disclaimer:
This issue was migrated on 2013-03-15 from the project's former issue tracker on Google Code, Issue #1091.
🌟   3 people had starred this issue at the time of migration.

@detro
Copy link
Collaborator Author

detro commented Feb 23, 2013

@ariya
Copy link
Owner

ariya commented Feb 25, 2013

[email protected] commented:

Looks good! Probably just need some sanity checks (for the properties) in the unit tests.

@arthurbailao
Copy link

[email protected] commented:

It would be useful too if the WebPage emit a loadProgress(int) signal, something like this:

connect(m_customWebPage, SIGNAL(loadProgress(int)), this, SIGNAL(loadProgress(int)), Qt::QueuedConnection);

Then, on webpage.js define a javascript interface named onLoadProgress:

definePageSignalHandler(page, handlers, "onLoadProgress", "loadProgress");

@detro
Copy link
Collaborator Author

detro commented Mar 18, 2013

This will be implemented by #11146.

@wachunga
Copy link

+1 to @arthurbailao suggestion of a load progress callback.

vitallium pushed a commit to vitallium/phantomjs that referenced this issue May 28, 2013
This commit provides the unit tests for the new property, as asked by
Ariya in ariya#11091.
ManuelB pushed a commit to ManuelB/phantomjs that referenced this issue Dec 28, 2013
For whatever reason, swapping the order with the render() tests solve the
intermittent random failures. Also, split the tests between loading
start and finish checks (to better recognize which one is failing, if
there is a failure), also make the tests more asynchoronous.

ariya#11091
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants