How to go to a web page and wait for it to load in a user extension

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

How to go to a web page and wait for it to load in a user extension

GW-5
I am trying to write an extension that goes to a designated web page. For example:

Selenium.prototype.doGotoYahoo = function() {
    this.browserbot.openLocation("http://yahoo.com);
};

This doesn't seem to wait for the page to fully load.

Any ideas would be appreciated.

Thanks,
Henri
---------------------------------------------------------------------
Posted via Jive Forums
http://forums.openqa.org/thread.jspa?threadID=1190&messageID=3395#3395

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: How to go to a web page and wait for it to load in a user extension

GW-5
Of course I can call *AndWait but I need to run more commands on the loaded pages within the method.
---------------------------------------------------------------------
Posted via Jive Forums
http://forums.openqa.org/thread.jspa?threadID=1190&messageID=3398#3398

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: How to go to a web page and wait for it to load in a user extension

David Kemp
In reply to this post by GW-5

henri shahrouz <[hidden email]> wrote on 17/02/2006 02:58:00 AM:

> I am trying to write an extension that goes to a designated web page.
> For example:
>
> Selenium.prototype.doGotoYahoo = function() {
>     this.browserbot.openLocation("http://yahoo.com);
> };
>
> This doesn't seem to wait for the page to fully load.
>
> Any ideas would be appreciated.

If you look at the implementation of doOpen() in selenium-api.js you will see that it returns SELENIUM_PROCESS_WAIT to indicate that Selenium needs to wait for a page load before continuing.  Your follow-up email indicated that you wanted to "run more commands on the loaded pages within the method".  Unfortunately you will not be able to do this because commands that need to wait for a page load needs to return control to the main execution loop.  Blame it on Java Script's lack of support for threads :-)

Cheers,
David

David Kemp
ThoughtWorks Australia Pty Ltd
http://www.thoughtworks.com

Reply | Threaded
Open this post in threaded view
|

Re: How to go to a web page and wait for it to load in a

GW-5
Thanks David. May be there is another way to accomplish what I was trying to do:
- create commands that do common tasks in tests, for example, login.

We are using jsp's to do that to some extent, but one nice thing about the command approach is that when the end users see the test they don't have to worry about uninteresting detail.

Henri
---------------------------------------------------------------------
Posted via Jive Forums
http://forums.openqa.org/thread.jspa?threadID=1190&messageID=3451#3451

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]