0

In an Eclipse 3.7 RCP app, I would like to get the Default perspective switcher button via id for SWTBot/unit testing purposes to get around this:

assertNotNull("PerspectiveBar not visisble", bot.toolbarButtonWithTooltip("Perspektive öffnen"));

How do I find out the id of the button to be able to use

assertNotNull("PerspectiveBar not visisble", bot.toolbarButtonWithId("somekey", "someid"));

Or: is there a better (internationalization-independent) way to do this, may setting key/id of this button by myself?

Thx.

1 Answers1

0

If you want to find any widget with SWTBot by an id, you have to set the id against key "org.eclipse.swtbot.widget.key".

widget.setData("org.eclipse.swtbot.widget.key", "my.widget.id");

Now you can get the widget like below

bot.widget(withId("my.widget.id"));

For your case it will be

bot.toolbarButtonWithId("someid");

But before that you must ensure you set the id against the key mentioned above.

coder11
  • 457
  • 3
  • 9