Question

I want to right click a context menu using swtbot, I am using the following code:

treeitem.setFocus();
treeitem.contextMenu("context_menu_text").click();

The above code works fine in windows, but in Linux it throws a widget not found error. treeitem is the project in Project explorer. Here is the full code:

SWTBotView view_project_explorer = bot.viewByTitle("Project Explorer");
List<Tree> controls = new ChildrenControlFinder(view_project_explorer.getWidget()).findControls(WidgetOfType.widgetOfType(Tree.class));
SWTBotTree tree = new SWTBotTree((Tree) controls.get(0));
SWTBotTreeItem treeitem = tree.getTreeItem("myProject");

To get the tree I have also tried the bot.tree() method directly, still it works only on windows not on Linux.
Also, I don't have a shortcut for the context menu option that I want to access.

Was it helpful?

Solution

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top