我想使用swtbot右键单击上下文菜单,我使用以下代码:
treeitem.setFocus();
treeitem.contextMenu("context_menu_text").click();
以上代码在Windows中运行良好,但在Linux中它会抛出一个未找到的小部件错误。 treeitem是Project explorer中的项目。 这是完整的代码:
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");
为了获得树,我也直接尝试了bot.tree()方法,它仍然适用于不在Linux上的Windows。
另外,我没有我想要访问的上下文菜单选项的快捷方式。
答案 0 :(得分:0)
这可能是SWTBot中的一个错误。您应该报告:https://wiki.eclipse.org/SWTBot/Contributing#Report_a_bug_or_suggest_an_enhancement