WidgetNotFoundException

WindowTester allows you to easily create and run unit tests for every GUI they build. It can also be used to generate system level tests.

Moderators: gnebling, Eric Clayberg, Dan Rubel, keertip, Phil Quitslund

WidgetNotFoundException

Postby hoshang.varshney » Tue Feb 22, 2011 9:19 pm

ui.click(new CComboItemLocator("Ad Commerce", new SWTWidgetLocator(
CCombo.class, 0, new SWTWidgetLocator(Composite.class))));
ui.click(new CComboItemLocator("Affiliates", new SWTWidgetLocator(
CCombo.class, 0, new SWTWidgetLocator(Composite.class))));
ui.click(2, new XYLocator(new LabeledTextLocator("Service &Version:"),
15, 3));

ui.enterText("2.0.0");


I am getting WidgetNotFoundException at the bold line. How do I solve it?
hoshang.varshney
 
Posts: 10
Joined: Tue Feb 15, 2011 4:56 am

Re: WidgetNotFoundException

Postby gnebling » Wed Feb 23, 2011 11:43 am

Possible reasons why you might be getting a WidgetNotFoundException:

1) Does your Application/window have focus?
2) Is your Widget visible?
3) When you Playback your test, does it show the same window when you recorded it?
4) Are you using dual monitors and your test test plays on the wrong monitor?
gnebling
Moderator
 
Posts: 243
Joined: Tue Aug 22, 2006 7:49 am

Re: WidgetNotFoundException

Postby hoshang.varshney » Thu Feb 24, 2011 12:59 am

I think its the option 1 applicable in my case. So, how do I bring that particular window in focus?
hoshang.varshney
 
Posts: 10
Joined: Tue Feb 15, 2011 4:56 am

Re: WidgetNotFoundException

Postby gnebling » Thu Feb 24, 2011 10:51 am

Check out the ensureThat() method... replace the WorkbenchLocator with your window.
Code: Select all
ui.ensureThat(new WorkbenchLocator().hasFocus());
gnebling
Moderator
 
Posts: 243
Joined: Tue Aug 22, 2006 7:49 am


Return to Window Tester

Who is online

Users browsing this forum: No registered users and 1 guest

cron