Automation Question:

Tell us what methods of Robot Class do you know?

Tweet Share WhatsApp

Answer:

Some commonly and popularly used methods of Robot Class during web automation:

keyPress(): method with press down arrow key of Keyboard
Example:

keyPress(KeyEvent.VK_DOWN)
keyRelease(): method with release down arrow key of Keyboard:
Example:

robot.keyRelease(KeyEvent.VK_DOWN)
mouseRelease() method will release the right click of your mouse
Example:

mouseRelease(InputEvent.BUTTON3_DOWN_MASK)
mouseMove() method will move mouse pointer to the specified X and Y coordinates.
Example:

robot.mouseMove(point.getX(), point.getY())
mousePress() method will press the right click of your mouse.
Example :

robot.mousePress(InputEvent.BUTTON3_DOWN_MASK)

Download Automation PDF Read All 108 Automation Questions
Previous QuestionNext Question
Do you know how to locate a link using its text in Selenium?Tell us how to login into any site if it’s showing any authentication pop-up for username and password?