mercredi 25 mars 2015

Key press simulation in unit testing

I wrote below code to press three tab keys after that press enter key using robot. But it doesn't work as expected.



public void test_11() throws InterruptedException, AWTException {
Robot robot=new Robot();

robot.keyPress(KeyEvent.VK_TAB);
robot.keyRelease(KeyEvent.VK_TAB);
robot.keyPress(KeyEvent.VK_TAB);
robot.keyRelease(KeyEvent.VK_TAB);
robot.keyPress(KeyEvent.VK_TAB);
robot.keyRelease(KeyEvent.VK_TAB);
robot.keyPress(KeyEvent.VK_ENTER);
robot.keyRelease(KeyEvent.VK_ENTER);
}

Aucun commentaire:

Enregistrer un commentaire