如何使用 appium 调用 adb 命令?



如何使用appium调用adb命令。 此driver.executeScript ("mobile: shell", Cmd);无济于事,因为这仅适用于内部 Android 系统。我需要执行这样的命令adb backup -noshared com.android.chrome -f /home/profiles/chrome.adb

但我需要在不跌倒的情况下做到这一点。如果我直接从Runtime.getRuntime().exec(Cmd)执行此操作,appium将掉落

您可能想要查看 ProcessBuilder 类。

ProcessBuilder pb = new ProcessBuilder("adb", "backup", "-noshared", "com.android.chrome", "-f", "/home/profiles.chrome.adb");
Process pc = pb.start();
pc.waitFor();

最新更新