Jump to: navigation, search

SWTBot/Snippets

< SWTBot
Revision as of 02:36, 10 January 2009 by Ketanpadegaonkar.gmail.com (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Some snippets for working with SWTBot


Switch perspective

This allows you to switch perspectives in eclipse from within the Window>Open Perspective>Other... menu.

// Change the perspective via the Open Perspective dialog       
bot.menu("Window").menu("Open Perspective").menu("Other...").click();
SWTBotShell openPerspectiveShell = bot.shell("Open Perspective");
 
SWTBotTable table = new SWTBotTable((Table) bot.widget(widgetOfType(Table.class), openPerspectiveShell.widget));
table.select("Debug");
 
SWTBotButton OkButton = new SWTBotButton((Button) bot.widget(widgetOfType(Button.class), openPerspectiveShell.widget));
OkButton.click();