Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Protractor - does anybody know how to click on element with RIGHT MOUSE BUTTON?

I know that protractor click on element by default with left mouse button. How to do it to click with RIGHT MOUSE BUTTON ?

el.click('RIGHT'); ?

like image 220
georgw Avatar asked Mar 13 '14 17:03

georgw


People also ask

How do you right click with a protractor?

click(protractor. Button. RIGHT). perform(); await browser.

How do you click a button with a protractor?

As we click up and down the button on the mouse to perform an activity. Similarly, the mouse up and mouse down methods in Protractor are used to click up and down the primary mouse button.


2 Answers

I would have done like this:

browser.actions().mouseMove(el.find()).perform();
browser.actions().click(protractor.Button.RIGHT).perform();

Based on what I saw in actionsequence.js and Protractor rightClick issue #280

like image 74
glepretre Avatar answered Sep 21 '22 11:09

glepretre


The accepted solution for this question isn't the best way to go about this. Browser actions' .click() method accepts an optional arg for clicking the right button. A better solution, from the webdriverJs api is:

browser.actions()
    .click($('.myElm'), protractor.Button.RIGHT)
    .perform();
like image 29
Brine Avatar answered Sep 21 '22 11:09

Brine