如何使用 javascript 通过 appium 打开/关闭辅助功能

J.A*_*ari 5 javascript accessibility talkback appium appium-android

我有这个用于 android 的 adb shell 命令并尝试使用终端,它运行良好。

但不确定如何使用 appium 命令在框架中使用它。

// disable
adb shell settings put secure enabled_accessibility_services com.android.talkback/com.google.android.marvin.talkback.TalkBackService

// enable
adb shell settings put secure enabled_accessibility_services com.google.android.marvin.talkback/com.google.android.marvin.talkback.TalkBackService
Run Code Online (Sandbox Code Playgroud)

J.A*_*ari 0

这对我有用。

const { exec } = require('child_process');

exec('adb shell settings put secure enabled_accessibility_services com.google.android.marvin.talkback/com.google.android.marvin.talkback.TalkBackService', (err, stdout, stderr) => {
        if (err) {
          return;
        }
});
Run Code Online (Sandbox Code Playgroud)