Jump to: navigation, search

Difference between revisions of "SWTBot/Snippets"

(created a snippets page)
 
m
Line 10: Line 10:
 
bot.menu("Window").menu("Open Perspective").menu("Other...").click();
 
bot.menu("Window").menu("Open Perspective").menu("Other...").click();
 
SWTBotShell openPerspectiveShell = bot.shell("Open Perspective");
 
SWTBotShell openPerspectiveShell = bot.shell("Open Perspective");
     
+
openPerspectiveShell.activate();
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();
+
</source>
+
  
 +
// select the dialog
 +
bot.table().select("Debug");
 +
bot.button("OK").click();
 +
</source>
  
 
[[Category: SWTBot]]
 
[[Category: SWTBot]]

Revision as of 02:41, 10 January 2009

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");
openPerspectiveShell.activate();
 
// select the dialog
bot.table().select("Debug");
bot.button("OK").click();