In my code I select a node from a SapTree
and
String key = tree.findNodeKeyByPath(path);
tree.selectNode(key);
tree.nodeContextMenu(key);
but instead of opening a context menu, it results in an exception:
java.lang.RuntimeException: Error executing 'NodeContextMenu'. An unexpected COM exception occurred at SAP Frontend Server (). .
at com.borland.silktest.jtf.internal.Agent.convertException(Agent.java:294)
at com.borland.silktest.jtf.internal.Agent.invoke(Agent.java:394)
at com.borland.silktest.jtf.AbstractTestObject.invoke(AbstractTestObject.java:462)
at com.microfocus.silktest.jtf.sap.SapTree.nodeContextMenu(SapTree.java:1490)
...
The nodeContextMenu() documentation is not very helpful regaring potential issues.
How can I open a context menu if not the way I did it?
This exception may occur if more than one node is selected, i.e. if a node was already selected before you selected the second one.
To clear all selected nodes, insert a call tree.unselectAll()
(Silk documentation)