Protractor - does anybody know how to click on ele

2020-05-28 10:43发布

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'); ?

3条回答
ゆ 、 Hurt°
2楼-- · 2020-05-28 11:13

Try this:

el.sendKeys(protractor.Key.RIGHT)

Here is the list of keys: https://code.google.com/p/selenium/source/browse/javascript/webdriver/key.js

If it doesn't work do this: https://groups.google.com/forum/#!topic/selenium-users/fF_Hcp40KO0

Let me know if it works

查看更多
老娘就宠你
3楼-- · 2020-05-28 11:29

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();
查看更多
神经病院院长
4楼-- · 2020-05-28 11:30

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

查看更多
登录 后发表回答