Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » SWTBot » buttons not found -- what can be done?
buttons not found -- what can be done? [message #487140] Tue, 22 September 2009 06:55 Go to next message
Steven Chamberlin is currently offline Steven Chamberlin
Messages: 30
Registered: July 2009
Member
I sometimes get "WidgetNotFoundException: Could not find widget" when I try to click on a button. This has happened even with simple next, finish and cancel buttons. Has anyone else experienced this? What can be done about it? This is a real problem for us because it means the testcases are not deterministic but having a random element of chance to them ...

I'm on SWT-Bot version 329 -- would upgrading help with this?

Thanks a lot!
-- Steven
Re: buttons not found -- what can be done? [message #487204 is a reply to message #487140] Tue, 22 September 2009 12:56 Go to previous message
Pascal G is currently offline Pascal G
Messages: 157
Registered: July 2009
Senior Member
Steven Chamberlin wrote:
> I sometimes get "WidgetNotFoundException: Could not find widget" when I
> try to click on a button. This has happened even with simple next,
> finish and cancel buttons. Has anyone else experienced this? What can
> be done about it? This is a real problem for us because it means the
> testcases are not deterministic but having a random element of chance to
> them ...
>
> I'm on SWT-Bot version 329 -- would upgrading help with this?
>
> Thanks a lot!
> -- Steven

WidgetNotFoundException is the general exception when a bot can't find a
widget. Usually there is a relevant message you are trying to find
something specific. For example, when using bot.button("foo"), you'll
get something close to "WidgetNotFoundException: Could not find widget
button with text "foo"".

Often, this can happen when the WorkbenchTestable thread (the thread on
which SWTBot runs) execute the search before the widget you are
searching for is shown. One good example of this is opening shells:
when opening a wizard, you should synchronize the WorkbenchTestable
thread with the UI thread using this
Matcher<Shell> matcher = withText("New Project");
getBot().waitUntil(waitForShell(matcher));

This is only an example. The SWTBot#waitUntil(ICondition) method can be
used with your own conditions for any synchronization you need.

If this does not help you at all, please post a snippet of something
that fails and I'll try to help you further.
--
Pascal GĂ©linas | Software Developer
*Nu Echo Inc.*
http://www.nuecho.com/ | http://blog.nuecho.com/

*Because performance matters.*
Previous Topic:Building an RCP application including swtbot tests
Next Topic:How to test non-eclipse code
Goto Forum:
  


Current Time: Thu Oct 30 16:37:48 GMT 2014

Powered by FUDForum. Page generated in 0.10451 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software