Part of the real machine may appear each run code, start the app will be repeatedly installed unlock and appium setting these two gadgets, some phones will automatically install, this is OK.
Some phones will pop up an installation confirmation box each time (such as some millet and vivo appear), so it is more troublesome, do not manually go to the point, you can not continue to execute the code.
Note: Appium older versions 1.4 and Appium desktop v1.7 after the installation path is not the same, there are differences
Appium Desktop (more than 1.7 version) as an example of the small series
My environment:
Appium Desktop version
1. First look at the Appium Desktop installation version, for example, my version is v1.7.1
2. After double-click the installation, will be installed to the C drive, you can search directly: Appium desktop, and then the following levels to find Android-helpers.js modify the following several places
\appium-desktop\resources\app\node_modules\appium\node_modules\appium-android-driver\lib
修改如下几个地方:1.注释掉355行 // await adb.install(unicodeIMEPath, false); 2.注释掉522行 // await helpers.pushSettingsApp(adb);3. 注释掉526行 // await helpers.pushUnlock(adb);
3. Continue to find the Android-helpers.js file under Build\lib
\appium-desktop\resources\app\node_modules\appium\node_modules\appium-android-driver\build\lib
Modify the following places: 1. Comment out 919 lines, then add a line of code//return _regeneratorruntime.awrap (Adb.install (_appiumandroidime.path, false)); return context$$0.abrupt (' return ', Defaultime); 2. Comment Out 1366 lines, then add a line of code// Return _ Regeneratorruntime.awrap (Helpers.pushsettingsapp (ADB)); return context$$0.abrupt (' return ', Defaultime); 3. Note 1380 lines, then add a line of code// Return _ Regeneratorruntime.awrap (Helpers.pushunlock (ADB)); return context$$0.abrupt (' return ', defaultime);
Save after modifying, then restart Appium, re-execute code, will not repeat installation unlock and appium setting
Appium Desktop command-line version
1. If the Appium command-line version is installed via NPM, my command-line version is 1.8.1, then search in C: NPM, then find the following path on the layer
\npm\node_modules\appium\node_modules\appium-android-driver
2. Open changes in \npm\node_modules\appium\node_modules\appium-android-driver\lib\android-helpers.js
修改如下几个地方:1.注释掉358行 // await adb.install(unicodeIMEPath, false); 2.注释掉570行 // await helpers.pushSettingsApp(adb);3. 注释掉581行 // await helpers.pushUnlock(adb);
3. Continue to open changes in \npm\node_modules\appium\node_modules\appium-android-driver\build\lib\android-helpers.js
Modify the following places: 1. Comment out 782 lines, then add a line of code//return _regeneratorruntime.awrap (Adb.install (_appiumandroidime.path, false)"); return context$1$0.abrupt ( Span class= "hljs-string" > ' return ', Defaultime); 2. Comment Out 1285 lines, then add a line of code//return _ Regeneratorruntime.awrap (Helpers.pushsettingsapp (ADB)); return context$1$0.abrupt ( Span class= "hljs-string" > ' return ', Defaultime); 3.1321 lines, then add a line of code//return _ Regeneratorruntime.awrap (Helpers.pushunlock (ADB)); return context$1$0.abrupt ( Span class= "hljs-string" > ' return ', defaultime);
This article is mainly to solve appium1.7 above version, different version number code line number will be a little bit different
Errors that may be encountered
1. If you encounter this error no such file or directory ' C:\node\stylus\package.json '. Then execute these 2 sentences.
npm install -g expressnpm init -y
View more Stackoverflowhttps://stackoverflow.com/questions/9484829/npm-cant-find-package-json
Appium+python Automated 55-appium Desktop installation unlock and Appium setting issues every time you start