Monday, 7 April 2014

Selenium WebDriver: Handle File Upload

In this post, we'll cover how to upload files using WebDriver.

As we click on 'Browse' button it opens windows ‘File Upload’ dialog, which cannot be handled by WebDriver as it can only handle web based application


So to make it work, first make sure that element is visible and Instead of clicking on Browse button will use sendkeys()

  • Find the xpath of 'Browse' button
  • Enter absolute path of file to upload
  • Find xpath of 'Upload' button and click. 

No comments:

Post a Comment