1 | appium-adb
|
2 | ==========
|
3 |
|
4 | [![NPM version](http://img.shields.io/npm/v/appium-adb.svg)](https://npmjs.org/package/appium-adb)
|
5 | [![Downloads](http://img.shields.io/npm/dm/appium-adb.svg)](https://npmjs.org/package/appium-adb)
|
6 | [![Dependency Status](https://david-dm.org/appium/appium-adb.svg)](https://david-dm.org/appium/appium-adb)
|
7 | [![devDependency Status](https://david-dm.org/appium/appium-adb/dev-status.svg)](https://david-dm.org/appium/appium-adb#info=devDependencies)
|
8 |
|
9 | [![Build Status](https://api.travis-ci.org/appium/appium-adb.png?branch=master)](https://travis-ci.org/appium/appium-adb)
|
10 | [![Coverage Status](https://coveralls.io/repos/appium/appium-adb/badge.svg?branch=master)](https://coveralls.io/r/appium/appium-adb?branch=master)
|
11 |
|
12 | A wrapper over android-adb, implemented using ES6 and along with `async/await`. This package is mainly used by Appium to perform all adb operations on android device.
|
13 |
|
14 | *Note*: Issue tracking for this repo has been disabled. Please use the [main Appium issue tracker](https://github.com/appium/appium/issues) instead.
|
15 |
|
16 | ## Installing
|
17 |
|
18 | ```bash
|
19 | npm install appium-adb
|
20 | ```
|
21 |
|
22 | ## Watch
|
23 |
|
24 | ```bash
|
25 | npm run watch
|
26 | ```
|
27 |
|
28 | ## Test
|
29 |
|
30 | ### unit tests
|
31 |
|
32 | ```bash
|
33 | npm run test
|
34 | ```
|
35 |
|
36 | ### functional tests
|
37 |
|
38 | By default the functional tests use an avd named `NEXUS_S_18_X86`, with API Level
|
39 | 18. To change this, you can use the environment variables `PLATFORM_VERSION`,
|
40 | `API_LEVEL`, and `ANDROID_AVD`. If `PLATFORM_VERSION` is set then it is not
|
41 | necessary to set `API_LEVEL` as it will be inferred.
|
42 |
|
43 | ```bash
|
44 | gulp e2e-test
|
45 | ```
|
46 |
|
47 | ## Usage:
|
48 |
|
49 | example:
|
50 |
|
51 | ```js
|
52 | import ADB from 'appium-adb';
|
53 |
|
54 | const adb = await ADB.createADB();
|
55 | console.log(await adb.getPIDsByName('com.android.phone'));
|
56 | ```
|
57 |
|
58 | ### List of methods:
|
59 |
|
60 | - `createADB`
|
61 | - `initJars`
|
62 | - `getAdbWithCorrectAdbPath`
|
63 | - `getAdbVersion`
|
64 | - `initAapt`
|
65 | - `initZipAlign`
|
66 | - `getApiLevel`
|
67 | - `isDeviceConnected`
|
68 | - `mkdir`
|
69 | - `isValidClass`
|
70 | - `forceStop`
|
71 | - `clear`
|
72 | - `stopAndClear`
|
73 | - `availableIMEs`
|
74 | - `enabledIMEs`
|
75 | - `enableIME`
|
76 | - `disableIME`
|
77 | - `setIME`
|
78 | - `defaultIME`
|
79 | - `keyevent`
|
80 | - `lock`
|
81 | - `back`
|
82 | - `goToHome`
|
83 | - `isScreenLocked`
|
84 | - `isSoftKeyboardPresent`
|
85 | - `sendTelnetCommand`
|
86 | - `isAirplaneModeOn`
|
87 | - `setAirplaneMode`
|
88 | - `broadcastAirplaneMode`
|
89 | - `isWifiOn`
|
90 | - `getScreenSize`
|
91 | - `getScreenDensity`
|
92 | - `setWifiState`
|
93 | - `isDataOn`
|
94 | - `setDataState`
|
95 | - `setWifiAndData`
|
96 | - `rimraf`
|
97 | - `push`
|
98 | - `pull`
|
99 | - `processExists`
|
100 | - `forwardPort`
|
101 | - `reversePort` (ApiLevel >=21)
|
102 | - `forwardAbstractPort`
|
103 | - `ping`
|
104 | - `restart`
|
105 | - `startLogcat`
|
106 | - `stopLogcat`
|
107 | - `getLogcatLogs`
|
108 | - `getPIDsByName`
|
109 | - `killProcessesByName`
|
110 | - `killProcessByPID`
|
111 | - `broadcastProcessEnd`
|
112 | - `broadcast`
|
113 | - `endAndroidCoverage`
|
114 | - `instrument`
|
115 | - `androidCoverage`
|
116 | - `packageAndLaunchActivityFromManifest`
|
117 | - `compileManifest`
|
118 | - `insertManifest`
|
119 | - `hasInternetPermissionFromManifest`
|
120 | - `getSdkBinaryPath`
|
121 | - `getBinaryFromSdkRoot`
|
122 | - `getBinaryFromPath`
|
123 | - `getConnectedDevices`
|
124 | - `getDevicesWithRetry`
|
125 | - `restartAdb`
|
126 | - `adbExec`
|
127 | - `shell`
|
128 | - `getAdbServerPort`
|
129 | - `getEmulatorPort`
|
130 | - `getPortFromEmulatorString`
|
131 | - `getConnectedEmulators`
|
132 | - `setEmulatorPort`
|
133 | - `setDeviceId`
|
134 | - `getRunningAVD`
|
135 | - `getRunningAVDWithRetry`
|
136 | - `killAllEmulators`
|
137 | - `launchAVD`
|
138 | - `waitForEmulatorReady`
|
139 | - `waitForDevice`
|
140 | - `reboot`
|
141 | - `signWithDefaultCert`
|
142 | - `signWithCustomCert`
|
143 | - `sign`
|
144 | - `zipAlignApk`
|
145 | - `checkApkCert`
|
146 | - `checkCustomApkCert`
|
147 | - `getKeystoreMd5`
|
148 | - `checkApkKeystoreMatch`
|
149 | - `isAppInstalled`
|
150 | - `startApp`
|
151 | - `startUri`
|
152 | - `getFocusedPackageAndActivity`
|
153 | - `waitForActivityOrNot`
|
154 | - `waitForActivity`
|
155 | - `waitForNotActivity`
|
156 | - `uninstallApk`
|
157 | - `installFromDevicePath`
|
158 | - `install`
|
159 | - `fingerprint` (ApiLevel >=23 | emulator only)
|
160 | - `sendSMS` (emulator only)
|
161 | - `rotate` (emulator only)
|
162 | - `powerAC` (emulator only)
|
163 | - `powerCapacity` (emulator only)
|
164 | - `powerOFF` (emulator only)
|
165 | - `gsmCall` (emulator only)
|
166 | - `gsmSignal` (emulator only)
|
167 | - `gsmVoice` (emulator only)
|
168 | - `root`
|
169 | - `unroot`
|