1

I have using recursiveTreeNodesAdaptor in seam. And I want to add child this tree via contextMenu and when user click right node of tree open context menu and click left then open modal panel. I want to do this.

When I try to write selenium test this flow I dont click to rigt and open contextMenu. I try to selenium.contextmenu(xpath) but i'm fail.

So, How can I click to right


I tried to simulate right click with user extension. My function is below:

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);
}};

I managed to call the function from IDE. But, now, I get the error "this.waitForCondition is not a function". What's wrong? Do you have any idea?

Thanks in advance.

shafak
  • 57
  • 1
  • 9

2 Answers2

1

The latest selenium has a namespace called OpenQA.Selenium.Interactions Namespace. check it out here.

see my other post here

Community
  • 1
  • 1
Peter Agnew
  • 361
  • 3
  • 3
1

Try using fireEvent on that element. You should also take a look at this post which seems to be about the same issue.

Community
  • 1
  • 1
Ashkan Aryan
  • 3,504
  • 4
  • 30
  • 44