webdriver :: contextClick(webElement)无法打开上下文菜单 [英] webdriver :: contextClick(webElement) not opening the context menu

查看:143
本文介绍了webdriver :: contextClick(webElement)无法打开上下文菜单的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在尝试使用硒2打开自动测试的上下文菜单.我尝试过的事情是:-

I have been trying to open the context menu for my automated test using selenium 2. The things I have tried are:-

WebDriver driver = new FirefoxDriver();
Actions actions = new Actions(driver);
//location is = "largeImageF-img"
WebElement webElement = driver.findElement(By.id(location));
actions.contextClick(webElement);

它没有打开上下文菜单.

Its not opening the context menu.

我尝试使用

selenium.contextMenu(xpath);
//selenium was instantiated using WebDriverBackedSelenium

任何指导将不胜感激.谢谢

Any guidance would be appreciated. Thanks

推荐答案

Action类实现构建器模式.因此,您可以链接多个调用以创建一个动作序列.要执行它们,必须最后调用perform():

The Action class implements the builder pattern. Thus you can chain several calls to create one sequence of actions. To execute them, you must invoke perform() in the end:

actions.contextClick(webElement).perform();

您的代码不执行该操作.

Your code does not execute the action.

这篇关于webdriver :: contextClick(webElement)无法打开上下文菜单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆