【发布时间】:2018-01-18 13:12:57
【问题描述】:
在 Firefox 量子上使用 selenium 3.5 选择 WebElement 后,我一直在尝试按 (CTRL + ALT + 'f')。这是我写的代码:
WebElement ele = m_driver.findElement(By.cssSelector(".tm-project-name"));
ele.click();
Actions act = new Actions(m_driver);
act.sendKeys(Keys.CONTROL).perform();
act.sendKeys(Keys.ALT).perform();
act.sendKeys("f").perform();
为了完成这项工作,我也尝试了这种方法
act.sendKeys(Keys.chord(Keys.CONTROL, Keys.ALT, "F")).build().perform();
这两种方法在 chrome 浏览器上都可以正常工作,但在 Firefox Quantum 中无法正常工作。 谁能帮我解决这个问题。
【问题讨论】:
-
你试图通过 control+Alt+"f" 的目的是什么?
-
而不是整个
Actions act ... act.sendKeys("f").perform();部分,点击后尝试添加:ele.sendKeys(Keys.chord(Keys.CONTROL, Keys.ALT, "F")); -
@Pradeephebbar 我需要在我的应用程序中执行此操作并突出显示一个元素。
-
@GalAbra 我也试过了,但这在 Firefox 量子中不起作用。
-
Javaclick()会发生什么?你看到任何错误吗?更新问题中的错误堆栈跟踪。同时更新press (CTRL + ALT + 'f')的用途。
标签: selenium selenium-chromedriver sendkeys geckodriver firefox-quantum