如何使用Selenium 2发送键盘快捷键Alt + Shift + Z(热键)? [英] How can I send keyboard shortcut Alt + Shift + Z (hotkey) with Selenium 2?
本文介绍了如何使用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);
这篇关于如何使用Selenium 2发送键盘快捷键Alt + Shift + Z(热键)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文