[Browser] How to know when setURL has finished [message #645541] |
Fri, 17 December 2010 13:47  |
Eclipse User |
|
|
|
I'm trying to use the SWT Browser widget to do some junit testing. The first thing I need it to do is load a URL. So, how can I know when the browser has finished loading that URL and I can start asking it to evaluate snippets of javascript needed to kick of the tests?
I tried adding a progress listener, setting the URL, and waiting for the "complete" callback. That seemed to work with Safari (although maybe I got lucky). But there seem to be multiple "complete" events, and waiting for the first one failed with IE. When I called Browser#evaluate(), the page's javascript hadn't yet been evaluated.
This seems like such a simple thing to do. Has anyone figured out how to know when the browser has finished loading the page?
|
|
|
Re: [Browser] How to know when setURL has finished [message #646237 is a reply to message #645541] |
Wed, 22 December 2010 15:15  |
Eclipse User |
|
|
|
Hi Randy, sorry for the late reply,
Listening for completed() is the right thing do to here, only one of these
should be received for a page load. Perhaps the first one coming in is
triggered by something like a XHR completion? Please log a report with swt
and this can be investigated.
Grant
"Randy Hudson" <hudsonr@us.ibm.com> wrote in message
news:iegb01$2jk$1@news.eclipse.org...
> I'm trying to use the SWT Browser widget to do some junit testing. The
> first thing I need it to do is load a URL. So, how can I know when the
> browser has finished loading that URL and I can start asking it to
> evaluate snippets of javascript needed to kick of the tests?
>
> I tried adding a progress listener, setting the URL, and waiting for the
> "complete" callback. That seemed to work with Safari (although maybe I
> got lucky). But there seem to be multiple "complete" events, and waiting
> for the first one failed with IE. When I called Browser#evaluate(), the
> page's javascript hadn't yet been evaluated.
>
> This seems like such a simple thing to do. Has anyone figured out how to
> know when the browser has finished loading the page?
|
|
|
Powered by
FUDForum. Page generated in 0.07014 seconds