Upload file in Selenium webdriver using Robot class

Upload file in Selenium Webdriver using Robot Class

Hello, Welcome to Selenium tutorials in this post we will see how to upload file in Selenium Webdriver using Robot class.

 

Upload file in Selenium Webdriver using Robot Class

Upload file in Selenium using robot class

 

There are multiple ways to upload files in Selenium Webdriver

  • You can directly use sendKeys(“File path”) method but sometime this methods does not work.
  • We can use Robot class to upload files in Selenium, which we will discuss today.

If you are new to Selenium and not aware of Robot class then check below article which will describe you about robot class

Robot class in Selenium Webdriver

 

  • We can upload files using AutoIT as well.

 

 

Robot class is not part of Selenium it comes with Java but we can use the same here.We have to use some keyboard event to perform this.
Step 1- We have to copy the file location in system clipboard.
Step 2- We have to click on upload button and use CTR+V and ENTER.
Note- Robot class each key has to press and release respectively

 

Scenario-
1-Open Firefox and Create profile in monster.com
2- Click on upload button and select the file and save
Lets implement the same

 

Program-Upload file in Selenium Webdriver using Robot Class

 

Please comment below you are facing any issue while uploading file

Now if you are comfortable with Basic Selenium, you can check out Advance Selenium Tutorial as well. 🙂

For More updates Learn Automation page

For any query join Selenium group- Selenium Group

43 Comments

  1. vinay
  2. Roma
  3. BISHNU DAS
  4. Nikhil
  5. sandip
  6. Reshma Sultana
    • Manoj Kumar
      • Reshma Sultana
        • Manoj Kumar
  7. Deepak
  8. Adilakshmi
  9. Reshma