[Tutor] How to get Selenium to wait for page load

Marco Mistroni mmistroni at gmail.com
Thu Jan 31 06:14:27 EST 2019


Hi
You won't find much help here as this is a python moist
Have a look at WebDriverWait from selenium.webdriver.support.ui

It allows you to wait for certain conditions
Hth

On Thu, Jan 31, 2019, 11:09 AM <mhysnm1964 at gmail.com wrote:

> Hi all,
>
>
>
> I have found an excellent article on identifying stale elements. The issue
> is when I try and use their example code. I get a failure where for_wait is
> not defined.
>
>
> http://www.obeythetestinggoat.com/how-to-get-selenium-to-wait-for-page-load-
> after-a-click.html
> <http://www.obeythetestinggoat.com/how-to-get-selenium-to-wait-for-page-load-after-a-click.html>
>
>
>
> Traceback (most recent call last):
> File "<stdin>", line 5, in <module>
> NameError: name 'wait_for' is not defined
> >>>
>
>
>
> When I look through the examples. I only find one reference for the above
> function. But it doesn't look correct and I am confused. The author
> indicates the definition of the function is half way up the page. As I
> cannot see, this reference doesn't help. So can someone help and provide
> the
> definition for this method/function?
>
>
>
> The code which generated the error:
>
>
>
> rows = []
>
> pageNav = browser.find_element_by_id("center-5")
>
> curr_page = pageNav.find_element_by_css_selector('span
> .pageNumberElement').text
>
> prev_page = ""
>
> while prev_page in curr_page:
>
> #    wait_for(link_has_gone_stale):
>
>     prev_page = curr_page
>
>     rows.extend(tableNavigation (pageNav))
>
>     if wait_for(link_has_gone_stale):
>
>         pageNav = browser.find_element_by_id("center-5")
>
>     curr_page = pageNav.find_element_by_css_selector('span
> .pageNumberElement').text
>
>     if prev_page == curr_page:
>
>         print ("Page no has not changed:",curr_page)
>
>     else:
>
>         prev_page = curr_page
>
>
>
>
>
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> To unsubscribe or change subscription options:
> https://mail.python.org/mailman/listinfo/tutor
>


More information about the Tutor mailing list