What is Robot Class in Selenium Webdriver and Usage

Hello, Welcome to Selenium Tutorials, In this post, we will see how to use Robot class in Selenium Webdriver.

I have used Robot class couple of times in my test script and it worked well. I uploaded one article on upload file using robot class

How to upload files in Selenium using Robot class.


Robot class in Selenium Webdriver

While working with robot class I faced so many issues like it works on Latest window only so in some cases it won’t work I solved it using AutoIT .

AutoIT– Upload files in Selenium using AutoIT.


Now let’s discuss Robot class in Webdriver.

Robot class is a separate class in Java which will allow us to perform multiple tasks based on our requirement. It generally will throw AWT exception so we need to deal with it accordingly.

Using Robot class, we can simulate keyboard event in Selenium.

To use keyboard events you have to use to a method of Robot class.


Robot Class in Selenium Webdriver



Each key has to be press and release respectively-


Scenario- Which cover enter key

1-Open Facebook.

2- Enter Username and password.

3- Using robot class press Enter button.


Program for  Robot Class in Selenium Webdriver


If you like this post and if you feel its informative then please comment below and share with others as well.

Keep visiting, have a nice day :)


For More updates Learn Automation page

For any query join Selenium group- Selenium Group


  1. Shailendra singh panwar
  2. Learner
  3. prajeeth
  4. Girish
  5. celine
  6. Reshma Sultana
      • Reshma Sultana
  7. Aileen
  8. Manas
  9. ManiRaj