splinter icon indicating copy to clipboard operation
splinter copied to clipboard

Need functionality to check whether page has been loaded

Open sidchilling opened this issue 11 years ago • 9 comments

It is a normal requirement that any point of time we should be able to inspect whether the browser has completed loading the page.

This is a requirement because when a page navigation happens via JavaScript, say on the click of a button somewhere, there is no way of knowing whether the browser has completed loading the page as on click the control comes back (as opposed to visit() where control does not come back unless the page has been completely loaded).

With this functionality, one can inspect and then continue when the page has been loaded.

sidchilling avatar Jun 16 '13 18:06 sidchilling

+1

0o-de-lally avatar Aug 20 '13 21:08 0o-de-lally

I've made it on splinter driver for pyfunct. Take a look: https://github.com/gabrielpjordao/pyfunct/blob/master/pyfunct/contrib/splinter_driver.py#L109

We could implement something like this on splinter. What do you guys think about it?

gabrielpjordao avatar Aug 20 '13 22:08 gabrielpjordao

I think it's fine. But Selenium could use its own only way to wait for the page to load (check that other similar issue, I can't access it now) instead of the Javascript way, that could be the default behavior when the driver doesn't support it somehow.

On Tue, Aug 20, 2013 at 7:04 PM, Gabriel [email protected] wrote:

I've made it on splinter driver for pyfunct. Take a look:

https://github.com/gabrielpjordao/pyfunct/blob/master/pyfunct/contrib/splinter_driver.py#L109

We could implement something like this on splinter. What do you guys think about it?

— Reply to this email directly or view it on GitHubhttps://github.com/cobrateam/splinter/issues/237#issuecomment-22981510 .

Douglas Camata Graduando em Ciência da Computação (UENF)

Blog: http://douglascamata.net Github: http://github.com/douglascamata Twitter: @douglascamata http://twitter.com/douglascamata

http://twitter.com/douglascamataSkype: douglas_camata

Linux User #509211

douglascamata avatar Aug 20 '13 22:08 douglascamata

I like Gabriel's approach, it should work in most stacks. Also there's

selenium.wait_for_page_to_load(10000) Lucas Geiger

On Tue, Aug 20, 2013 at 6:10 PM, Douglas Camata [email protected] wrote:

I think it's fine. But Selenium could use its own only way to wait for the page to load (check that other similar issue, I can't access it now) instead of the Javascript way, that could be the default behavior when the driver doesn't support it somehow.

On Tue, Aug 20, 2013 at 7:04 PM, Gabriel [email protected] wrote:

I've made it on splinter driver for pyfunct. Take a look:

https://github.com/gabrielpjordao/pyfunct/blob/master/pyfunct/contrib/splinter_driver.py#L109

We could implement something like this on splinter. What do you guys think about it?

— Reply to this email directly or view it on GitHubhttps://github.com/cobrateam/splinter/issues/237#issuecomment-22981510 .

Douglas Camata Graduando em Ciência da Computação (UENF)

Blog: http://douglascamata.net Github: http://github.com/douglascamata Twitter: @douglascamata http://twitter.com/douglascamata

http://twitter.com/douglascamataSkype: douglas_camata

Linux User #509211

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

0o-de-lally avatar Aug 20 '13 22:08 0o-de-lally

I'm +1 for visit(wait_page_load=True). And each driver should use it native implementation, like wait_for_page_to_load for selenium drivers.

andrewsmedina avatar Aug 21 '13 05:08 andrewsmedina

Nice @andrewsmedina, but I think we should add it to the click event too, which has the problem described on the issue.

gabrielpjordao avatar Aug 21 '13 13:08 gabrielpjordao

@gabrielpjordao I disagree. That could be another separated method and be called just after a click or any other interaction. Maybe there could be an option in click method to automatic call it after the click itself.

douglascamata avatar Aug 21 '13 15:08 douglascamata

Yeah, I'm just saying that it'd be useful to have it possible on click (not default) event, since @andrewsmedina mentioned putting it on visit method.

Maybe something like click(wait_page_load=True) or a click_and_wait() shortcut.

gabrielpjordao avatar Aug 21 '13 16:08 gabrielpjordao

Is this still implemented? I am eagerly waiting for this feature

marufmax avatar Jun 18 '19 05:06 marufmax

Selenium now waits for page load by default. It must be disabled via an Options parameter: https://www.selenium.dev/documentation/webdriver/drivers/options/#pageloadstrategy

It won't handle complex hydration scenarios, but strategies for dealing with that are going to be specific to the web app being automated.

jsfehler avatar Feb 21 '24 16:02 jsfehler