Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » [Browser] How to know when setURL has finished
[Browser] How to know when setURL has finished [message #645541] Fri, 17 December 2010 13:47 Go to next message
Randy Hudson is currently offline Randy Hudson
Messages: 122
Registered: July 2009
Senior Member
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 Go to previous message
Grant Gayed is currently offline Grant Gayed
Messages: 2148
Registered: July 2009
Senior Member
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?
Previous Topic:RefreshProblem: Adding new TableItem with TableEditor
Next Topic:Redraw issue if i hover a window over a transparent shell.
Goto Forum:
  


Current Time: Thu Jul 31 07:36:29 EDT 2014

Powered by FUDForum. Page generated in 0.02461 seconds