How to send keyboard shortcut ALT SHIFT z (hotkey) with Selenium2?

前端 未结 3 1146
感情败类
感情败类 2020-12-05 15:47

I am trying send shortcut with Actions.sendKeys, but it isn\'t work.

(New Actions(driver)).SendKeys(Keys.ALT, Keys.SHIFT, \"z\");
3条回答
  •  醉酒成梦
    2020-12-05 16:25

    You can check this question to refer about this - Key press in (Ctrl+A) 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);
    

提交回复
热议问题