How do I use "Wait Until Page Loaded"?

6,185 views
Skip to first unread message

Mark Pawelek

unread,
Jan 17, 2011, 6:13:26 AM1/17/11
to robotframe...@googlegroups.com
Under what circumstances can I use the keyword "Wait Until Page Loaded"?


The code below times out after 5 seconds.

| *Keyword*         | *Action*                | *Argument*  | *Argument*  | *Argument*  | *Argument*  |
| Follow Slow Link  | [Arguments]             | ${link1}    | ${title1}   | ${url1}     | ${content1} |
|                   | Click Link              | ${link1}    |             |             |             |
|                   | Wait Until Page Loaded  |     20000   |             |             |             |
|                   | Title should be         | ${title1}   |             |             |             |
|                   | Location Should Be      | ${url1}     |             |             |             |
|                   | Page should contain     | ${content1} |             |             |             |
|                   | Go Back                 |             |             |             |             |

| *Test Case*        | *Action*         | *Argument* | *Argument*           | *Argument*    | *Argument*            |
| Follow UK Map Link | Follow Slow Link | UK_MapLink | MySite - Google Maps | ${UK_MAP_URL} | Some Text in the page |


NB:
${link1}    : id of hyperlink
${title1}   : tile of page to be followed
${url1}     : url to follow
${content1} : some specific content on that page

Janne Härkönen

unread,
Jan 17, 2011, 9:01:51 AM1/17/11
to mark...@gmail.com, robotframe...@googlegroups.com
On Mon, Jan 17, 2011 at 1:13 PM, Mark Pawelek <mark...@gmail.com> wrote:
> Under what circumstances can I use the keyword "Wait Until Page Loaded"?
>
> The code below times out after 5 seconds.
> | *Keyword*         | *Action*                | *Argument*  | *Argument*  |
> *Argument*  | *Argument*  |
> | Follow Slow Link  | [Arguments]             | ${link1}    | ${title1}   |
> ${url1}     | ${content1} |
> |                   | Click Link              | ${link1}    |             |
>             |             |
> |                   | Wait Until Page Loaded  |     20000   |             |
>             |             |

Hello Mark,

By default, Click Link -keyword waits for the page load, and uses the
library timeout (which by default happens to be 5 seconds). In order
to tell Click Link not wait, you can add a second argument to it like
this:
| Click Link | ${link1} | and don't wait |

This should allow all the waiting to happen with Wait Until Page Loaded.

hth,
__j

--
Janne Härkönen | http://reaktor.fi
http://twitter.com/#!/janneharkonen

Pekka Klärck

unread,
Jan 17, 2011, 12:36:34 PM1/17/11
to janne.t....@gmail.com, mark...@gmail.com, robotframe...@googlegroups.com
2011/1/17 Janne Härkönen <janne.t....@gmail.com>:

> On Mon, Jan 17, 2011 at 1:13 PM, Mark Pawelek <mark...@gmail.com> wrote:
>> Under what circumstances can I use the keyword "Wait Until Page Loaded"?
>>
>> The code below times out after 5 seconds.
[snip]

>
> By default, Click Link -keyword waits for the page load, and uses the
> library timeout (which by default happens to be 5 seconds). In order
> to tell Click Link not wait, you can add a second argument to it like
> this:
> | Click Link              | ${link1}    |  and don't wait  |
>
> This should allow all the waiting to happen with Wait Until Page Loaded.

An alternative solution is setting longer Selenium timeout (via import
argument or using Set Selenium Timeout keyword) and removing Wait
Until Page Loaded altogether in favor of automatic waiting.

Cheers,
.peke
--
Agile Tester/Developer/Consultant :: http://eliga.fi
Lead Developer of Robot Framework :: http://robotframework.org

nast...@gmail.com

unread,
Jan 17, 2011, 1:11:40 PM1/17/11
to Pekka Klärck, janne.t....@gmail.com, mark...@gmail.com, robotframe...@googlegroups.com
Did that keyword ever get updated to work with AJAX pages? I remember at one point that it wouldn't work with those, and we ended up writing our own.

Nick
> --
>
> You received this message because you are subscribed to the Google Groups "robotframework-users" group.
>
> To post to this group, send email to robotframe...@googlegroups.com.
>
> To unsubscribe from this group, send email to robotframework-u...@googlegroups.com.
>
> For more options, visit this group at http://groups.google.com/group/robotframework-users?hl=en.
>
>
>

Pekka Klärck

unread,
Jan 17, 2011, 1:21:39 PM1/17/11
to nast...@gmail.com, janne.t....@gmail.com, mark...@gmail.com, robotframe...@googlegroups.com
2011/1/17 <nast...@gmail.com>:

> Did that keyword ever get updated to work with AJAX pages? I remember at one
> point that it wouldn't work with those, and we ended up writing our own.

If you mean pages that are only partly loaded dynamically, then Wait
Until Page Loaded or the automatic waiting after certain keywords
doesn't work. This limitation is due to these mechanisms waiting for
page load event which never occurs because no new page is loaded. In
these cases you can use Wait Until Page Contains, Wait Until Page
Contains Element, or Wait For Condition keywords, or wrap any other
keyword with BuiltIn keyword Wait Until Keyword Succeeds.

nast...@gmail.com

unread,
Jan 17, 2011, 4:44:03 PM1/17/11
to Pekka Klärck, nast...@gmail.com, janne.t....@gmail.com, mark...@gmail.com, robotframe...@googlegroups.com
I think our workaround was to wait for a browser attribute (or something like that) that declared the page "ready". Bryan might know more about our fix. (or i guess i could go look at our source >_>)

Nick

Pekka Klärck

unread,
Jan 19, 2011, 2:41:24 PM1/19/11
to Mark.P...@ft.com, robotframework-users
[Sending reply also to rf-users.]

2011/1/18 <Mark.P...@ft.com>:
> Thanks Janne and Pekka
>
> I'm doing this:
>
> | Click Link              | ${link1}    |  dont_wait  |
>
> It's working OK now.

Great! Notice that you don't need to have exactly `dont_wait` as the
second argument. Having any non-empty string there is enough, so you
can make the data a little more readable by writing it, for example,
like `| Click Link | ${link1} | and don't wait |`.

> I definitely Like the Robot Framework. It seems to be the best ATTD
> framework out there.

Thanks a lot! Always nice to hear positive feedback. =)

> A detailed tutorial would be an improvement though. Even without such a
> tutorial it is very easy to use.

Yeah, we definitely miss getting started material and simple examples.
The User Guide is pretty comprehensive, and I'm very proud we have
such good documentation, but it's more like a reference guide than a
tutorial.

Hopefully some day we have tutorials, examples, screencasts, dedicated
books, ... I'm also hoping the community can help with them.

Shailaja(Riya)

unread,
May 21, 2015, 8:03:46 AM5/21/15
to robotframe...@googlegroups.com
I am not able to  see Wait Until Page Loaded keyword in robot framework 2.8.7
Reply all
Reply to author
Forward
0 new messages