How to upload a file from desktop(or any folder in pc) to application (Junit or java)



  • Using Selenium webdriver with chrome browser for automation - Junit or java programming - how to upload a file from desktop(or any folder in pc) to application



  • A sample program for it: public class FileUpload { public static void main (String args[]) { WebDriver driver = new FirefoxDriver(); driver.get("http://www.2shared.com/"); driver.findElement(By.id("upField")).sendKeys("D:\james.xls"); driver.findElement(By.xpath("//input[@title='Upload file']")).click(); } }



Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2