selenium-webdriverRobot In Selenium


Syntax

  • delay(int ms)
  • keyPress(int keycode)
  • keyRelease(int keycode)
  • mouseMove(int x, int y)
  • mousePress(int buttons)
  • mouseRelease(int buttons)
  • mouseWheel(int wheelAmt)

Parameters

ParameterDetails
msTime to sleep in milliseconds
keycodeConstant to press the specified key for example to press A code is VK_A. Please refer for more details :https://docs.oracle.com/javase/7/docs/api/java/awt/event/KeyEvent.html
x,yScreen coordintates
buttonsThe Button mask; a combination of one or more mouse button masks
wheelAmtNumber of notches to move mouse wheel, negative value to move up/away from user positive value to move down/towards user

Remarks

This section contains details about implementation of Robot API with Selenium Webdriver. The Robot class is used to generate native system input when selenium is not capable to do that for example pressing right key of mouse, pressing F1 key etc.