如何通过Selenium2发送键盘快捷键ALT SHIFT z(热键)? [英] How to send keyboard shortcut ALT SHIFT z (hotkey) with Selenium2?
本文介绍了如何通过Selenium2发送键盘快捷键ALT SHIFT z(热键)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试使用Actions.sendKeys发送快捷方式,但这是行不通的.
I am trying send shortcut with Actions.sendKeys, but it isn't work.
(New Actions(driver)).SendKeys(Keys.ALT, Keys.SHIFT, "z");
推荐答案
You can check this question to refer about this - Key press in (Ctrl+A) Selenium WebDriver
检查使用 chord方法的答案,您可以这样做-
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);
这篇关于如何通过Selenium2发送键盘快捷键ALT SHIFT z(热键)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文