I am trying to upload a file to https://the-internet.herokuapp.com/upload via Chrome using Appium. But it leads to ERR_ACCESS_DENIED error all the time.
The file resides in the Download folder of my device.
Refer the image below:
I have tried the following capabilities as well with different combinations, but it didn't help: noReset, autoGrantPermissions, fastReset.
My Script:
from appium import webdriver
import time
def execute_script():
driver = webdriver.Remote(
command_executor='http://0.0.0.0:4723/wd/hub',
desired_capabilities={
"platform": "android",
"platformName": "android",
"platformVersion": "10",
"deviceName": "<xxxx>",
"udid": "<xxxx>",
"browserName": "chrome",
"automationName": "UIAutomator2",
"chromeOptions": {
"w3c": False
},
# "autoGrantPermissions": True,
# "noReset": True,
# "fastReset": True,
# "fullReset": False
}
)
driver.get('https://the-internet.herokuapp.com/upload')
up = driver.find_element_by_id("file-upload")
up.send_keys("/sdcard/Download/file.pdf")
driver.find_element_by_id("file-submit").click()
driver.quit()
driver = execute_script()
The script executes fine till the send_keys step. But as soon as the file-submit click is performed, it leads to the mentioned error. I tried it on https://fileconvoy.com/ as well and it results in the same error.
Version Details:
- Appium Version:
1.17.0(Tried version from1.10.xto1.20.x) - Device: Samsung Galaxy S9, Android 10
- Chromedriver: 90.0.4430.24 (Tried for Chrome 81 as well, same error).
What all I have tried:
- Granted permissions via the following command explicitly before starting appium (and also midway of the script in case the permissions get reset), but no luck.
adb -P 5037 shell 'pm grant com.android.chrome android.permission.READ_EXTERNAL_STORAGE android.permission.WRITE_EXTERNAL_STORAGE'
- Instead of using
browserName: "Chrome", I have also tried specifyingappPackage and appActivityto begin chrome. But no luck.
Is there anything that I am fundamentally missing? This works fine on desktop browsers (using selenium). But I haven't been able to run it once on my mobile device.
Let me know if there is anything else that I should share.
Have created an issue on Appium as well: https://github.com/appium/appium/issues/15293
