MacBook Appium 禁止每次執行都會啟動appium setting 、appium unlock
阿新 • • 發佈:2019-02-18
這裡就以1.7.1 mac版本的appium為例子:(用命令安裝Appium,其他方式安裝appium 根路徑有可能不一樣)
# 因為appium(版本1.7.1)會每次測試會自動的安裝所需要的setting\unlock\ime等apk,所以需要按照以下步驟進行註釋,以遮蔽掉他們自己的安裝:
# 快速定位檔案快捷方式普通鍵盤:windows+shift+G ;蘋果鍵盤:Option+shift+G (焦點必須在桌面快捷鍵才能使用)
1、檔案:
/usr/local/lib/node_modules/appium/node_modules/appium-android-driver/lib/driver
.js,註釋以下幾句程式碼
await this.adb.uninstallApk(this.opts.appPackage);
await helpers.installApkRemotely(this.adb, this.opts);
await helpers.resetApp(this.adb, this.opts.app, this.opts.appPackage, this.opts.fastReset);
await this.checkPackagePresent();
2、檔案:
/usr/local/lib/node_modules/appium/node_modules/appium-android-driver/build/lib/driver
.js 註釋以下幾句程式碼
return
_regeneratorRuntime.awrap(_androidHelpers2[
'default'
].resetApp(this.adb, this.opts.app, this.opts.appPackage, this.opts.fastReset));
return
_regeneratorRuntime.awrap(this.adb.uninstallApk(this.opts.appPackage));
return
_regeneratorRuntime.awrap(_androidHelpers2[
'default'
].installApkRemotely(this.adb, this.opts));
return
_regeneratorRuntime.awrap(this.checkPackagePresent());
3、檔案:
/usr/local/lib/node_modules/appium/node_modules/appium-android-driver/lib/android-helpers
.js 註釋以下幾句程式碼
await adb.
install
(unicodeIMEPath,
false
);
await helpers.pushSettingsApp(adb);
await helpers.pushUnlock(adb);
4、檔案
/usr/local/lib/node_modules/appium/node_modules/appium-android-driver/build/lib/android-helpers
.js 替換以下幾句程式碼
return
_regeneratorRuntime.awrap(helpers.initUnicodeKeyboard(adb))
替換為
return
context$1$0.abrupt(
'return'
, defaultIME);
return
_regeneratorRuntime.awrap(helpers.pushSettingsApp(adb));
替換為
return
context$1$0.abrupt(
'return'
, defaultIME);
return
_regeneratorRuntime.awrap(helpers.pushUnlock(adb));
替換為
return
context$1$0.abrupt(
'return'
, defaultIME);
其中
1、修改之後需要重啟電腦設定才會生效
2、windwos環境中的修改辦法都是一樣的,檔案路徑也相同,原文連結
【轉載】:https://zhidao.baidu.com/question/1695605908497972788.html