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

巧了我就是萌 提交于 2019-12-20 12:40:55

问题


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


回答1:


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




回答2:


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



回答3:


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



来源:https://stackoverflow.com/questions/22386637/protractor-does-anybody-know-how-to-click-on-element-with-right-mouse-button

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!