Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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

(New Actions(driver)).SendKeys(Keys.ALT, Keys.SHIFT, "z");
like image 572
Volkov Pavel Avatar asked Jul 17 '12 10:07

Volkov Pavel


People also ask

How do I send shortcuts in Selenium?

We can send keyboard shortcut ALT SHIFT z(hotkey) with Selenium webdriver. This can be done with the help of the Keys class. We shall use the Keys. chord method and pass Keys.

What command is this shortcut key Ctrl Shift Z?

A shortcut key of a "redo" action is now Ctrl+Y in all Microsoft Office products. However, a lot of other programs like Matlab, Adobe Illustrator, and even old versions of Microsoft Office had "redo" action shortcut key as Ctrl+Shift+Z.


1 Answers

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);
like image 193
Hari Reddy Avatar answered Sep 27 '22 21:09

Hari Reddy