Appium - File upload to web using Chrome - ERR_ACCESS_DENIED
It turns out, Chrome can't access /sdcard/Download/
directory during Automation.
Trying to upload a file from /data/local/tmp/
directory (by pushing a file there first) worked.
Secondly, there is a slight difference between Android 9 and Android 10+ considering the file download and upload scenarios for the path /sdcard/Download/
(yet to come up with a reasoning for this):
- In case of file download:
- Android 10 and above don't ask for any permission (i.e. no dialog box pops up)
- Android 9 (and probably below that), opens up a dialog box asking for the permission.
- In case of file upload:
- None of them ask for any permission, and thus the upload fails.
Therefore, as a workaround to upload files, we have two ways of doing so:
- Either using some other directory, i.e.
/data/local/tmp/
(The only thing I found working for Android 10 and above). - (For Android 9 and probably below too) Download any file first, allow/accept the permissions requested. Then proceed to upload from the
/sdcard/Download/
directory.