I'm trying to run SWTbot test case that uses keyboard short-cuts. I could not find any reference for how to do it.

I'm pretty sure that should not be that difficult. I'll appreciate it if someone can write a small snippet.

Thanks,

Ziv

有帮助吗?

解决方案

What about using the pressShortcut() methood?

For TreeItem:

final SWTBotTreeItem item = ...
item.select().pressShortcut(SWT.CTRL, 'F');

For TableItem:

final SWTBotTableItem item = ...
item.select().pressShortcut(SWT.CTRL, 'F');

For EclipseEditor

((SWTBotEclipseEditor)bot.activeEditor()).pressShortcut(SWT.CTRL, '1')

From Active Shell:

 bot.activeShell().pressShortcut(
        Keystrokes.CTRL, KeyStroke.getInstance("1"));

其他提示

For multiple modifiers keys you can use

item.select().pressShortcut(SWT.CTRL | SWT.ALT, 'F');
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top