Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » SWTBot » SWTBot cannot find pop up message box
SWTBot cannot find pop up message box [message #837688] Fri, 06 April 2012 01:08 Go to next message
Lia Gao is currently offline Lia Gao
Messages: 2
Registered: March 2012
Junior Member
Hi,

I tried to write an automation test to create a simple J2EE app. However, after I clicked "Finish". A "Open Associated Perspective" message box always popped up. I tried to close it using code below:

bot.button("Finish").click();
bot.sleep(20000);
String oap ="Open Associated Perspective?";
for (SWTBotShell shell : bot.shells()) {
if (shell.getText().equals(oap)) {
shell.activate();
bot.checkBoxWithLabel("Remember my decision").click();
bot.button("Yes").click();
break;
}
}
}catch(WidgetNotFoundException e){
fail("cannot find open associated perspective?"); //for test purpose
}

And it always fail because it cannot find the message box. Actually, I did see the box popped up. Why SWTBot cannot find this shell?

Thanks
Re: SWTBot cannot find pop up message box [message #887215 is a reply to message #837688] Sat, 16 June 2012 08:02 Go to previous message
Timur Achmetow is currently offline Timur Achmetow
Messages: 38
Registered: April 2012
Member
Is the message box native SWT? I ask, because SWTBot can't handle native SWT dialogs like message boxes or file dialogs.
Suggestion: work in your application code with (JFace) MessageDialog.openInformation(....) and not nativ SWT dialogs.
This works fine with SWTBot.
Previous Topic:Exception in thread "WorkbenchTestable"
Next Topic:How to add external jar file into Plug-in Dependencies hierarchy under SWTBot Test Plug-in project
Goto Forum:
  


Current Time: Wed Sep 17 03:38:55 GMT 2014

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

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