如何使用Selenium 2发送键盘快捷键Alt + Shift + Z(热键)?
问题描述:
我正在尝试使用Actions.sendKeys发送快捷方式,但是它不起作用.
I am trying send a shortcut with Actions.sendKeys, but it isn't working.
(New Actions(driver)).SendKeys(Keys.ALT, Keys.SHIFT, "z");
答
You can check this question to refer about this - Pressing Ctrl+A in Selenium WebDriver
检查使用和弦方法的答案.就您而言,您可以执行此操作-
Check the answer which uses the chord method. In your case, you can do this -
String selectAll = Keys.chord(Keys.ALT, Keys.SHIFT,"z");
driver.findElement(By.tagName("html")).sendKeys(selectAll);