Share
Go down
Niyati
Posts : 1
Join date : 2013-09-26

How to Upload File/Photo using “Upload Image Button” in Selenium Webdriver

on Thu Sep 26, 2013 5:22 pm
Code:
  WebElement UploadImg = driver.findElement(By.xpath("//*[@id='file_upload_button']"));
  UploadImg.click();
  WebElement frame =driver.switchTo().activeElement();
  frame.sendKeys("d:\5.jpg");
This code just open system window but it doesn't select any Photo/File
Neutral
avatar
rohit13
Master
Master
Posts : 180
Join date : 2012-03-29
Age : 31
Location : INDIA
http://radical-qa.blogspot.in/

Re: How to Upload File/Photo using “Upload Image Button” in Selenium Webdriver

on Mon Oct 07, 2013 2:01 am
You can not handle that pop-up in this way, but you can directly pass path of your file with sendkeys with upload button locator.

_________________
Radical QA
http://radical-qa.blogspot.in/
nabhanya.varma
Active particpant
Active particpant
Posts : 13
Join date : 2014-03-02

Re: How to Upload File/Photo using “Upload Image Button” in Selenium Webdriver

on Tue Dec 16, 2014 12:30 am
First and the Easy way is simple case of just finding the element and typing the absolute path of the document into it using SendKeys. But that may not work for cases where customized button is used.

You need to go for AutoIt tool or Using Robots class
Check the below link for examples:

Upload Document/File
http://seleniumeasy.com/tags/upload
Sponsored content

Re: How to Upload File/Photo using “Upload Image Button” in Selenium Webdriver

Back to top
Permissions in this forum:
You cannot reply to topics in this forum