0

I have tried using actions class but still not working

  1.  Actions action=new Actions(getDriver());
     String ctrlY=Keys.chord(Keys.CONTROL,"y");
     action.sendKeys(ctrlY);
    
  2.  Actions action=new Actions(getDriver());
     action.keyDown(Keys.ALT).sendKeys("z").keyUp(Keys.ALT).perform();
    

above two ways are not working for undo/redo actions

1 Answer 1

-1

If the sendKeys() method of Selenium isn't working for you I suggest you try the Robot framework for using keyboard shortcuts.

You can do something like;

Robot robot = new Robot();
Thread.sleep(1000);
robot.delay(3000);


robot.keyPress(KeyEvent.VK_CONTROL);
robot.keyPress(KeyEvent.VK_Y);
robot.keyRelease(KeyEvent.VK_CONTROL);
robot.keyRelease(KeyEvent.VK_Y);

I guess this would help sort your problem.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.