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

后端 未结 3 1843
渐次进展
渐次进展 2021-02-06 07:29

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条回答
  • 2021-02-06 07:32

    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

    0 讨论(0)
  • 2021-02-06 07:41

    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();
    
    0 讨论(0)
  • 2021-02-06 07:43

    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

    0 讨论(0)
提交回复
热议问题