How to select an item from “context list Menu” - protrator

女生的网名这么多〃 提交于 2019-12-08 10:44:18

问题


Here is the link of the question I had asked earlier, but the thread was inactive for quick a while, so asking the question fresh again.

Question: I can right click on an element but unable to select an item from the "Context List menu"(the one without a DOM). When I press "ARROW_DOWN" thrice the actual page moves down, instead of the selection on the Context menu. I researched a bit but no luck.

My guess is that the context menu is not focused, but not 100% sure. I tried to take a snapshot once I Right Clicked, and the snapshot doesn't contain the "Context menu".

Code to Right Click element and press down Arrow keys:

browser.actions().click(elementVariable).perform();

browser.actions().click(protractor.Button.RIGHT).sendKeys(protractor.Key.ARROW_DOWN).sendKeys(protractor.Key.ARROW_DOWN).sendKeys(protractor.Key.ARROW_DOWN).perform();

Code for taking snapshot:

browser.actions().click(elementVariable).perform();
    browser.actions().click(protractor.Button.RIGHT).perform()
     .then(function() {
         browser.takeScreenshot().then(function(screenShot) {
            writeScreenShot(screenShot, "image.png");
    });
    });

    //writeScreenShot takes two variables actual screenshot data and the file name. And the screenshot is saved as "image.png

Kindly let me know:

  1. How can I select an item from the "context menu" list?
  2. Why the "ARROW_DOWN" happening on the browser instead of the context menu list?
  3. what is the reason that the context menu isn't visible in the snapshot?

来源:https://stackoverflow.com/questions/34054640/how-to-select-an-item-from-context-list-menu-protrator

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