我在接缝中使用了recursiveTreeNodesAdaptor。我想通过contextMenu添加子树,当用户点击树的右边节点打开上下文菜单,然后点击左键,然后打开模态面板。我想做这个。如何在硒测试中点击右键
当我尝试写硒测试这个流程,我不点击rigt并打开contextMenu。我尝试selenium.contextmenu(xpath),但我失败了。
所以,我怎么可以点击右键
我试图模拟右键点击使用用户扩展。我的功能如下:
Selenium.prototype.doContextMenuClick = function(element){
var evt = document.createEvent('MouseEvents');
var RIGHT_CLICK_BUTTON_CODE = 2; // the same for FF and IE
evt.initMouseEvent('contextmenu', true, true,
document.defaultView, 1, 0, 0, 0, 0, false,
false, false, false, RIGHT_CLICK_BUTTON_CODE, null);
if (document.createEventObject){
// dispatch for IE
return document.fireEvent('onclick', evt);
}
else{
// dispatch for firefox + others
return !document.dispatchEvent(evt);
}};
我设法从IDE调用函数。但是,现在,我收到错误“this.waitForCondition不是函数”。怎么了?你有什么主意吗?
在此先感谢。
确定IM检查您的文章。 – shafak