I am not able to perform the control key press using selenium webdriver. My scenario is like press on control key, and click on one object and release the control key.
Actions actions = new Actions(driver);
actions.keyDown(Keys.LEFT_CONTROL)
.click(your_WebElement)
.keyUp(Keys.LEFT_CONTROL)
.build()
.perform();
0
votes
You can also use Robot Class to key down,
new Robot().keyPress(KeyEvent.VK_CONTROL);
driver.findElement(...).click();
new Robot().keyRelease(KeyEvent.VK_CONTROL);
We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it.OkRead more