且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

从 Selenium Webdriver 的右键菜单中选择一个选项 - Java

更新时间:2023-10-26 21:14:58

要从上下文菜单中选择项目,您只需使用 Key down 事件移动鼠标位置,如下所示:-

To select the item from the contextual menu, you have to just move your mouse positions with the use of Key down event like this:-

Actions action= new Actions(driver);
action.contextClick(productLink).sendKeys(Keys.ARROW_DOWN).sendKeys(Keys.ARROW_DOWN).sendKeys(Keys.RETURN).build().perform();

希望这对你有用.祝你有美好的一天:)

hope this will works for you. Have a great day :)