How can I send keyboard shortcut Alt + Shift + Z (hotkey) with Selenium 2?

Volkov Pavel picture Volkov Pavel · Jul 17, 2012 · Viewed 54.2k times · Source

I am trying send a shortcut with Actions.sendKeys, but it isn't working.

(New Actions(driver)).SendKeys(Keys.ALT, Keys.SHIFT, "z");

Answer

Hari Reddy picture Hari Reddy · Jul 17, 2012

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);