无法从右键单击操作启动新标签|爪哇硒
我正在尝试右键单击链接,并使用键箭头并输入以打开一个新选项卡。
问题:执行过程中未显示错误。确定该链接,并在其上右键单击。但是,该代码没有执行下箭头并输入操作。似乎无法弄清楚原因。 有人可以帮忙吗?
代码:
a.moveToElement(subfooterdriver.findElements(By.tagName("a")).get(1)).contextClick().sendKeys(Keys.ARROW_DOWN).sendKeys(Keys.RETURN).build().perform();
a -obj to Action类
, subfooterdriver-是由5个链接组成的框架
更新:
我能够通过以下代码克服问题,但我想了解第一个代码出了什么问题。
String clickonlink=Keys.chord(Keys.COMMAND,Keys.ENTER);
subfooterdriver.findElements(By.tagName("a")).get(i).sendKeys(clickonlink);
I'm trying to right-click on a link and use the keys arrow-down and enter to open a new tab.
Problem: No error displayed during execution. The link is identified and a right-click is made on it. however, the code is not performing the down-arrow and entering the action. Can't seem to figure out why.
Can somebody help?
Code:
a.moveToElement(subfooterdriver.findElements(By.tagName("a")).get(1)).contextClick().sendKeys(Keys.ARROW_DOWN).sendKeys(Keys.RETURN).build().perform();
a - obj to action class
,subfooterdriver - is a frame consisting of 5 links
Updated:
I was able to overcome the issue with the following code but I want to understand what went wrong with the first code.
String clickonlink=Keys.chord(Keys.COMMAND,Keys.ENTER);
subfooterdriver.findElements(By.tagName("a")).get(i).sendKeys(clickonlink);
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以在此超文本中获取链接,然后在新选项卡中打开它,如下:
You can get the link inside this hyper text then open it in new tab as following :