Appium Upload File using Selenium Webdriver sendKeys on Android/iOS device

Currently i use Appium and Selenium-Webdriver to run Automation Web Application on real iOS/Android device. I would like to know if there is a way where we can Upload file using SendKeys of Selenium-Webdriver ?

My test-running-machine is Win 7 64 bit

I have tried both using the path of file from the test-running-machine (e.g C:\file.jpg) and using path of file that on the device(Android/iOS) ( e.g /sdcard/Download/myfile.png).

Using file path from the test-running-machine it would upload a null file to the web-driver no excetpion

Using file path from the device itself web-driver will throw exception: “org.openqa.selenium.WebDriverException: unknown error: path is not absolute: /sdcard/Download/myfile.png”

Any help would be very much appreciated.

Ideally when script is running into device then path should be of a resource inside device

did u checked with adb commands if path u r using is correct

adb shell
cd /sdcard/Download
ls - if this displays myfine.png

@amitjaincoer191 Thanks for responding. I did run the command above to make sure the file is existed. Here is the output:

adb shell
shell@ASUS_T00F:/ $ cd sdcard/Download/
shell@ASUS_T00F:/sdcard/Download $ ls
myfile.png

try like this

sdcard/Download/myfine.png
/sdcard/Download/myfine.png
sdcard\Download\myfine.png
\sdcard\Download\myfine.png

@amitjaincoer191 Still no luck.

Exception: "org.openqa.selenium.WebDriverException: unknown error: path is not absolute: path\path " still appear

Thanks for helping.

Any help would very much appreciated

HI, Any solution ? were you able to upload file using appium driver?

Can someone post any solution for this issue?

Hey, Anyone found solution. I am also facing same issue.

I used driver.push(“file destination path in device”, new File(“system file path”);

Now I can see file in the device in above mentioned path, but If I check file.exists() ; always return false.

Same check If I do in android it returning ‘true’

Please can anyone help me to resolve this issue. Thanks in advance.