How to upload file using selenium webdriver in java?
If you click browse button, it will open a window for uploading the file.
Already we know, Selenium web driver can handle only web based application. It unable to find the window based application. So, It can't browse the files for uploading.
Then, How we can upload the file??The simple trick is, we need to specify the path of the file in the browse text box and click upload button
Here is the code:
driver.findElement(By.xpath("xpath of Browse_Textbox")).sendKeys("path_of_file");
driver.findElement(By.xpath("xpath of upload_file_Button")).click();
