I need to access files (R/W) on an Android device with Appium (in Java), on Windows.
I’m getting acquainted to adb
in order to at least know what path is expected for /data, /Download, etc., but it seems that it lacks permissions, even for the AUT data files.
I think the path itself is different from what I see on the device & PC, after searching here and there and noticing the “Internal storage” part is translated to the local language. But I don’t know how to find it so it’s recognized by Appium.
I tried commands such as this on the terminal:
adb shell ls -R
Which gave me irrelevant files as well as lots of:
map_files: Permission denied
ns: Permission denied
./proc/1286/task/1286/cwd: Permission denied
./proc/1286/task/1286/root: Permission denied
./proc/1286/task/1286/exe: Permission denied
fd: Permission denied
fdinfo: Permission denied
ns: Permission denied
Even when running terminal as administrator.
As for an adb command launched from my program, such as:
String cmd = " adb devices";
ProcessBuilder processBuilder = new ProcessBuilder();
processBuilder.command("sudo C:\Users\myUser\AppData\Local\Android\Sdk\platform-tools\adb.exe", cmd);
Process process = processBuilder.start();
It is simply not seen anywhere (neither Appium server log nor standard output).
My ultimate goal is to manipulate files; my command was:
`driver.pushFile("[can't find the expected filesystem mapping anywhere!!!] \storage(maybe??)\Download\bird.jpg", new File("C:\Users\myUser\Downloads\bird.jpg"));`
Which fails (once again, even with appium launched as administrator) with:
`adb: error: failed to copy 'C:UsersmyUserAppDataLocalTemp2024826-17660-y8us7v.ja5kaappium.tmp' to 'storageDownloadbird.jpg': remote couldn't create file: Read-only file system`
So are all Appium testers rooting their devices to be able to do data manipulation (even with their own app’s /data
) ?
Is there another way to access, list, copy or delete them?
4