appium-android-driver 12.4.6 → 12.4.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/build/lib/commands/app-management.d.ts +167 -113
- package/build/lib/commands/app-management.d.ts.map +1 -1
- package/build/lib/commands/app-management.js +147 -103
- package/build/lib/commands/app-management.js.map +1 -1
- package/build/lib/commands/file-actions.d.ts +37 -19
- package/build/lib/commands/file-actions.d.ts.map +1 -1
- package/build/lib/commands/file-actions.js +44 -58
- package/build/lib/commands/file-actions.js.map +1 -1
- package/build/lib/commands/find.d.ts +20 -3
- package/build/lib/commands/find.d.ts.map +1 -1
- package/build/lib/commands/find.js +10 -3
- package/build/lib/commands/find.js.map +1 -1
- package/build/lib/commands/intent.d.ts +103 -107
- package/build/lib/commands/intent.d.ts.map +1 -1
- package/build/lib/commands/intent.js +103 -97
- package/build/lib/commands/intent.js.map +1 -1
- package/build/lib/commands/performance.d.ts +80 -51
- package/build/lib/commands/performance.d.ts.map +1 -1
- package/build/lib/commands/performance.js +113 -89
- package/build/lib/commands/performance.js.map +1 -1
- package/build/lib/commands/recordscreen.d.ts +25 -40
- package/build/lib/commands/recordscreen.d.ts.map +1 -1
- package/build/lib/commands/recordscreen.js +46 -63
- package/build/lib/commands/recordscreen.js.map +1 -1
- package/build/lib/commands/shell.d.ts +21 -0
- package/build/lib/commands/shell.d.ts.map +1 -1
- package/build/lib/commands/shell.js +21 -0
- package/build/lib/commands/shell.js.map +1 -1
- package/build/lib/commands/streamscreen.d.ts +34 -64
- package/build/lib/commands/streamscreen.d.ts.map +1 -1
- package/build/lib/commands/streamscreen.js +41 -80
- package/build/lib/commands/streamscreen.js.map +1 -1
- package/build/lib/commands/types.d.ts.map +1 -1
- package/build/lib/driver.d.ts +2 -1
- package/build/lib/driver.d.ts.map +1 -1
- package/build/lib/driver.js.map +1 -1
- package/lib/commands/app-management.ts +639 -0
- package/lib/commands/{file-actions.js → file-actions.ts} +88 -74
- package/lib/commands/find.ts +20 -3
- package/lib/commands/intent.ts +422 -0
- package/lib/commands/{performance.js → performance.ts} +167 -108
- package/lib/commands/{recordscreen.js → recordscreen.ts} +77 -73
- package/lib/commands/shell.ts +21 -0
- package/lib/commands/{streamscreen.js → streamscreen.ts} +86 -109
- package/lib/commands/types.ts +17 -0
- package/lib/driver.ts +2 -1
- package/package.json +1 -1
- package/lib/commands/app-management.js +0 -533
- package/lib/commands/intent.js +0 -409
|
@@ -22,10 +22,17 @@ const MIN_EMULATOR_API_LEVEL = 27;
|
|
|
22
22
|
const FFMPEG_BINARY = `ffmpeg${support_1.system.isWindows() ? '.exe' : ''}`;
|
|
23
23
|
const ADB_PULL_TIMEOUT = 5 * 60 * 1000;
|
|
24
24
|
/**
|
|
25
|
+
* Starts screen recording on the Android device.
|
|
25
26
|
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
27
|
+
* This method uses Android's `screenrecord` command to capture the screen.
|
|
28
|
+
* The recording can be configured with various options such as video size,
|
|
29
|
+
* bit rate, time limit, and more.
|
|
30
|
+
*
|
|
31
|
+
* @param options Recording options. See {@link StartScreenRecordingOpts} for details.
|
|
32
|
+
* @returns Promise that resolves to the result of stopping any previous recording,
|
|
33
|
+
* or an empty string if no previous recording was active.
|
|
34
|
+
* @throws {Error} If screen recording is not supported on the device or emulator,
|
|
35
|
+
* or if the time limit is invalid.
|
|
29
36
|
*/
|
|
30
37
|
async function startRecordingScreen(options = {}) {
|
|
31
38
|
await verifyScreenRecordIsSupported(this.adb, this.isEmulator());
|
|
@@ -41,7 +48,8 @@ async function startRecordingScreen(options = {}) {
|
|
|
41
48
|
}
|
|
42
49
|
if (!lodash_1.default.isEmpty(this._screenRecordingProperties)) {
|
|
43
50
|
// XXX: this doesn't need to be done in serial, does it?
|
|
44
|
-
|
|
51
|
+
const props = this._screenRecordingProperties;
|
|
52
|
+
for (const record of props.records || []) {
|
|
45
53
|
await this.adb.rimraf(record);
|
|
46
54
|
}
|
|
47
55
|
this._screenRecordingProperties = undefined;
|
|
@@ -51,7 +59,7 @@ async function startRecordingScreen(options = {}) {
|
|
|
51
59
|
throw new Error(`The timeLimit value must be in range [1, ${MAX_TIME_SEC}] seconds. ` +
|
|
52
60
|
`The value of '${timeLimit}' has been passed instead.`);
|
|
53
61
|
}
|
|
54
|
-
|
|
62
|
+
const recordingProps = {
|
|
55
63
|
timer: new support_1.timing.Timer().start(),
|
|
56
64
|
videoSize,
|
|
57
65
|
timeLimit,
|
|
@@ -62,56 +70,66 @@ async function startRecordingScreen(options = {}) {
|
|
|
62
70
|
recordingProcess: null,
|
|
63
71
|
stopped: false,
|
|
64
72
|
};
|
|
65
|
-
|
|
73
|
+
this._screenRecordingProperties = recordingProps;
|
|
74
|
+
await scheduleScreenRecord.bind(this)(recordingProps);
|
|
66
75
|
return result;
|
|
67
76
|
}
|
|
68
77
|
/**
|
|
78
|
+
* Stops screen recording and returns the recorded video.
|
|
79
|
+
*
|
|
80
|
+
* This method stops any active screen recording session and returns the recorded
|
|
81
|
+
* video as a base64-encoded string or uploads it to a remote location if specified.
|
|
82
|
+
* If multiple recording chunks were created (for long recordings), they will be
|
|
83
|
+
* merged using ffmpeg if available.
|
|
69
84
|
*
|
|
70
|
-
* @
|
|
71
|
-
* @
|
|
72
|
-
*
|
|
85
|
+
* @param options Stop recording options. See {@link StopScreenRecordingOpts} for details.
|
|
86
|
+
* @returns Promise that resolves to the recorded video as a base64-encoded string
|
|
87
|
+
* if `remotePath` is not provided, or an empty string if the video was uploaded to a remote location.
|
|
88
|
+
* @throws {Error} If screen recording is not supported, no recording was active,
|
|
89
|
+
* or if the recording process cannot be stopped.
|
|
73
90
|
*/
|
|
74
91
|
async function stopRecordingScreen(options = {}) {
|
|
75
92
|
await verifyScreenRecordIsSupported(this.adb, this.isEmulator());
|
|
76
|
-
|
|
77
|
-
|
|
93
|
+
const props = this._screenRecordingProperties;
|
|
94
|
+
if (!lodash_1.default.isEmpty(props)) {
|
|
95
|
+
props.stopped = true;
|
|
78
96
|
}
|
|
79
97
|
try {
|
|
80
98
|
await terminateBackgroundScreenRecording(this.adb, false);
|
|
81
99
|
}
|
|
82
100
|
catch (err) {
|
|
83
|
-
this.log.warn(
|
|
84
|
-
if (!lodash_1.default.isEmpty(
|
|
101
|
+
this.log.warn(err.message);
|
|
102
|
+
if (!lodash_1.default.isEmpty(props)) {
|
|
85
103
|
this.log.warn('The resulting video might be corrupted');
|
|
86
104
|
}
|
|
87
105
|
}
|
|
88
|
-
if (lodash_1.default.isEmpty(
|
|
106
|
+
if (lodash_1.default.isEmpty(props)) {
|
|
89
107
|
this.log.info(`Screen recording has not been previously started by Appium. There is nothing to stop`);
|
|
90
108
|
return '';
|
|
91
109
|
}
|
|
92
|
-
if (
|
|
110
|
+
if (props.recordingProcess?.isRunning) {
|
|
93
111
|
try {
|
|
94
|
-
await
|
|
112
|
+
await props.recordingProcess.stop('SIGINT', PROCESS_SHUTDOWN_TIMEOUT);
|
|
95
113
|
}
|
|
96
114
|
catch {
|
|
97
115
|
throw this.log.errorWithException(`Unable to stop screen recording within ${PROCESS_SHUTDOWN_TIMEOUT}ms`);
|
|
98
116
|
}
|
|
99
|
-
|
|
117
|
+
props.recordingProcess = null;
|
|
100
118
|
}
|
|
101
|
-
if (lodash_1.default.isEmpty(
|
|
119
|
+
if (lodash_1.default.isEmpty(props.records)) {
|
|
102
120
|
throw this.log.errorWithException(`No screen recordings have been stored on the device so far. ` +
|
|
103
121
|
`Are you sure the ${SCREENRECORD_BINARY} utility works as expected?`);
|
|
104
122
|
}
|
|
105
123
|
const tmpRoot = await support_1.tempDir.openDir();
|
|
106
124
|
try {
|
|
107
125
|
const localRecords = [];
|
|
108
|
-
for (const pathOnDevice of
|
|
126
|
+
for (const pathOnDevice of props.records) {
|
|
109
127
|
const relativePath = path_1.default.resolve(tmpRoot, path_1.default.posix.basename(pathOnDevice));
|
|
110
128
|
localRecords.push(relativePath);
|
|
111
129
|
await this.adb.pull(pathOnDevice, relativePath, { timeout: ADB_PULL_TIMEOUT });
|
|
112
130
|
await this.adb.rimraf(pathOnDevice);
|
|
113
131
|
}
|
|
114
|
-
let resultFilePath =
|
|
132
|
+
let resultFilePath = lodash_1.default.last(localRecords);
|
|
115
133
|
if (localRecords.length > 1) {
|
|
116
134
|
this.log.info(`Got ${localRecords.length} screen recordings. Trying to merge them`);
|
|
117
135
|
try {
|
|
@@ -119,7 +137,7 @@ async function stopRecordingScreen(options = {}) {
|
|
|
119
137
|
}
|
|
120
138
|
catch (e) {
|
|
121
139
|
this.log.warn(`Cannot merge the recorded files. The most recent screen recording is going to be returned as the result. ` +
|
|
122
|
-
`Original error: ${
|
|
140
|
+
`Original error: ${e.message}`);
|
|
123
141
|
}
|
|
124
142
|
}
|
|
125
143
|
if (lodash_1.default.isEmpty(options.remotePath)) {
|
|
@@ -134,21 +152,11 @@ async function stopRecordingScreen(options = {}) {
|
|
|
134
152
|
}
|
|
135
153
|
}
|
|
136
154
|
// #region Internal helpers
|
|
137
|
-
/**
|
|
138
|
-
*
|
|
139
|
-
* @param {string} localFile
|
|
140
|
-
* @param {string} [remotePath]
|
|
141
|
-
* @param {import('./types').StopScreenRecordingOpts} uploadOptions
|
|
142
|
-
* @returns {Promise<string>}
|
|
143
|
-
*/
|
|
144
155
|
async function uploadRecordedMedia(localFile, remotePath, uploadOptions = {}) {
|
|
145
156
|
if (lodash_1.default.isEmpty(remotePath)) {
|
|
146
157
|
return (await support_1.util.toInMemoryBase64(localFile)).toString();
|
|
147
158
|
}
|
|
148
159
|
const { user, pass, method, headers, fileFieldName, formFields } = uploadOptions;
|
|
149
|
-
/**
|
|
150
|
-
* @type {import('@appium/support').NetOptions & import('@appium/support').HttpUploadOptions}
|
|
151
|
-
*/
|
|
152
160
|
const options = {
|
|
153
161
|
method: method || 'PUT',
|
|
154
162
|
headers,
|
|
@@ -158,25 +166,15 @@ async function uploadRecordedMedia(localFile, remotePath, uploadOptions = {}) {
|
|
|
158
166
|
if (user && pass) {
|
|
159
167
|
options.auth = { user, pass };
|
|
160
168
|
}
|
|
161
|
-
await support_1.net.uploadFile(localFile,
|
|
169
|
+
await support_1.net.uploadFile(localFile, remotePath, options);
|
|
162
170
|
return '';
|
|
163
171
|
}
|
|
164
|
-
/**
|
|
165
|
-
*
|
|
166
|
-
* @param {ADB} adb
|
|
167
|
-
* @param {boolean} isEmulator
|
|
168
|
-
*/
|
|
169
172
|
async function verifyScreenRecordIsSupported(adb, isEmulator) {
|
|
170
173
|
const apiLevel = await adb.getApiLevel();
|
|
171
174
|
if (isEmulator && apiLevel < MIN_EMULATOR_API_LEVEL) {
|
|
172
175
|
throw new Error(`Screen recording does not work on emulators running Android API level less than ${MIN_EMULATOR_API_LEVEL}`);
|
|
173
176
|
}
|
|
174
177
|
}
|
|
175
|
-
/**
|
|
176
|
-
* @this {import('../driver').AndroidDriver}
|
|
177
|
-
* @param {import('@appium/types').StringRecord} recordingProperties
|
|
178
|
-
* @returns {Promise<void>}
|
|
179
|
-
*/
|
|
180
178
|
async function scheduleScreenRecord(recordingProperties) {
|
|
181
179
|
if (recordingProperties.stopped) {
|
|
182
180
|
return;
|
|
@@ -184,7 +182,7 @@ async function scheduleScreenRecord(recordingProperties) {
|
|
|
184
182
|
const { timer, videoSize, bitRate, timeLimit, bugReport } = recordingProperties;
|
|
185
183
|
let currentTimeLimit = MAX_RECORDING_TIME_SEC;
|
|
186
184
|
if (support_1.util.hasValue(recordingProperties.currentTimeLimit)) {
|
|
187
|
-
const currentTimeLimitInt = parseInt(recordingProperties.currentTimeLimit, 10);
|
|
185
|
+
const currentTimeLimitInt = parseInt(String(recordingProperties.currentTimeLimit), 10);
|
|
188
186
|
if (!isNaN(currentTimeLimitInt) && currentTimeLimitInt < MAX_RECORDING_TIME_SEC) {
|
|
189
187
|
currentTimeLimit = currentTimeLimitInt;
|
|
190
188
|
}
|
|
@@ -202,12 +200,12 @@ async function scheduleScreenRecord(recordingProperties) {
|
|
|
202
200
|
}
|
|
203
201
|
const currentDuration = timer.getDuration().asSeconds.toFixed(0);
|
|
204
202
|
this.log.debug(`The overall screen recording duration is ${currentDuration}s so far`);
|
|
205
|
-
const timeLimitInt = parseInt(timeLimit, 10);
|
|
206
|
-
if (isNaN(timeLimitInt) || currentDuration >= timeLimitInt) {
|
|
203
|
+
const timeLimitInt = parseInt(String(timeLimit), 10);
|
|
204
|
+
if (isNaN(timeLimitInt) || Number(currentDuration) >= timeLimitInt) {
|
|
207
205
|
this.log.debug('There is no need to start the next recording chunk');
|
|
208
206
|
return;
|
|
209
207
|
}
|
|
210
|
-
recordingProperties.currentTimeLimit = timeLimitInt - currentDuration;
|
|
208
|
+
recordingProperties.currentTimeLimit = timeLimitInt - Number(currentDuration);
|
|
211
209
|
const chunkDuration = recordingProperties.currentTimeLimit < MAX_RECORDING_TIME_SEC
|
|
212
210
|
? recordingProperties.currentTimeLimit
|
|
213
211
|
: MAX_RECORDING_TIME_SEC;
|
|
@@ -218,7 +216,7 @@ async function scheduleScreenRecord(recordingProperties) {
|
|
|
218
216
|
await scheduleScreenRecord.bind(this)(recordingProperties);
|
|
219
217
|
}
|
|
220
218
|
catch (e) {
|
|
221
|
-
this.log.error(
|
|
219
|
+
this.log.error(e.stack);
|
|
222
220
|
recordingProperties.stopped = true;
|
|
223
221
|
}
|
|
224
222
|
})();
|
|
@@ -237,12 +235,6 @@ async function scheduleScreenRecord(recordingProperties) {
|
|
|
237
235
|
recordingProperties.records.push(pathOnDevice);
|
|
238
236
|
recordingProperties.recordingProcess = recordingProc;
|
|
239
237
|
}
|
|
240
|
-
/**
|
|
241
|
-
*
|
|
242
|
-
* @this {import('../driver').AndroidDriver}
|
|
243
|
-
* @param {string[]} mediaFiles
|
|
244
|
-
* @returns {Promise<string>}
|
|
245
|
-
*/
|
|
246
238
|
async function mergeScreenRecords(mediaFiles) {
|
|
247
239
|
try {
|
|
248
240
|
await support_1.fs.which(FFMPEG_BINARY);
|
|
@@ -260,12 +252,6 @@ async function mergeScreenRecords(mediaFiles) {
|
|
|
260
252
|
await (0, teen_process_1.exec)(FFMPEG_BINARY, args);
|
|
261
253
|
return result;
|
|
262
254
|
}
|
|
263
|
-
/**
|
|
264
|
-
*
|
|
265
|
-
* @param {ADB} adb
|
|
266
|
-
* @param {boolean} force
|
|
267
|
-
* @returns {Promise<boolean>}
|
|
268
|
-
*/
|
|
269
255
|
async function terminateBackgroundScreenRecording(adb, force = true) {
|
|
270
256
|
const isScreenrecordRunning = async () => lodash_1.default.includes(await adb.listProcessStatus(), SCREENRECORD_BINARY);
|
|
271
257
|
if (!await isScreenrecordRunning()) {
|
|
@@ -280,11 +266,8 @@ async function terminateBackgroundScreenRecording(adb, force = true) {
|
|
|
280
266
|
return true;
|
|
281
267
|
}
|
|
282
268
|
catch (err) {
|
|
283
|
-
throw new Error(`Unable to stop the background screen recording: ${
|
|
269
|
+
throw new Error(`Unable to stop the background screen recording: ${err.message}`);
|
|
284
270
|
}
|
|
285
271
|
}
|
|
286
272
|
// #endregion
|
|
287
|
-
/**
|
|
288
|
-
* @typedef {import('appium-adb').ADB} ADB
|
|
289
|
-
*/
|
|
290
273
|
//# sourceMappingURL=recordscreen.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"recordscreen.js","sourceRoot":"","sources":["../../../lib/commands/recordscreen.
|
|
1
|
+
{"version":3,"file":"recordscreen.js","sourceRoot":"","sources":["../../../lib/commands/recordscreen.ts"],"names":[],"mappings":";;;;;AAmCA,oDAyDC;AAgBD,kDAgFC;AA5LD,6CAAuE;AAEvE,uCAA0C;AAC1C,oDAAuB;AACvB,gDAAwB;AACxB,+CAAkC;AAKlC,MAAM,WAAW,GAAG,GAAG,CAAC;AACxB,MAAM,aAAa,GAAG,IAAI,CAAC;AAC3B,MAAM,sBAAsB,GAAG,EAAE,GAAG,CAAC,CAAC;AACtC,MAAM,YAAY,GAAG,EAAE,GAAG,EAAE,CAAC;AAC7B,MAAM,0BAA0B,GAAG,sBAAsB,CAAC;AAC1D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,iBAAiB,EAAE,EAAE,mBAAmB,CAAC,CAAC;IACjE,IAAI,CAAC,MAAM,qBAAqB,EAAE,EAAE,CAAC;QACnC,OAAO,KAAK,CAAC;IACf,CAAC;IAED,IAAI,CAAC;QACH,MAAM,GAAG,CAAC,KAAK,CAAC,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,EAAE,mBAAmB,CAAC,CAAC,CAAC;QACxE,MAAM,IAAA,2BAAgB,EAAC,KAAK,IAAI,EAAE,CAAC,CAAC,MAAM,qBAAqB,EAAE,EAAE;YACjE,MAAM,EAAE,wBAAwB;YAChC,UAAU,EAAE,GAAG;SAChB,CAAC,CAAC;QACH,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,MAAM,IAAI,KAAK,CACb,mDAAoD,GAAa,CAAC,OAAO,EAAE,CAC5E,CAAC;IACJ,CAAC;AACH,CAAC;AAED,aAAa"}
|
|
@@ -1,3 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Executes a shell command on the device via ADB.
|
|
3
|
+
*
|
|
4
|
+
* This method runs an arbitrary shell command on the Android device and returns
|
|
5
|
+
* the output. The command is executed using `adb shell` with the specified
|
|
6
|
+
* command and arguments.
|
|
7
|
+
*
|
|
8
|
+
* Requirements:
|
|
9
|
+
* - The adb_shell feature must be enabled
|
|
10
|
+
*
|
|
11
|
+
* @param command The shell command to execute (e.g., 'pm', 'dumpsys', 'getprop').
|
|
12
|
+
* @param args Optional array of command arguments.
|
|
13
|
+
* @param timeout The maximum time in milliseconds to wait for command execution.
|
|
14
|
+
* Defaults to 20000ms (20 seconds).
|
|
15
|
+
* @param includeStderr If `true`, returns both stdout and stderr in an object.
|
|
16
|
+
* If `false` or undefined, returns only stdout as a string.
|
|
17
|
+
* @returns If `includeStderr` is `true`, returns `{ stdout: string, stderr: string }`.
|
|
18
|
+
* Otherwise, returns the command output as a string.
|
|
19
|
+
* @throws {errors.InvalidArgumentError} If `command` is not a string.
|
|
20
|
+
* @throws {Error} If the command execution fails or times out.
|
|
21
|
+
*/
|
|
1
22
|
export declare function mobileShell<T extends boolean>(command: string, args?: string[], timeout?: number, includeStderr?: T): Promise<T extends true ? {
|
|
2
23
|
stdout: string;
|
|
3
24
|
stderr: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shell.d.ts","sourceRoot":"","sources":["../../../lib/commands/shell.ts"],"names":[],"mappings":"AAMA,wBAAsB,WAAW,CAAC,CAAC,SAAS,OAAO,EACjD,OAAO,EAAE,MAAM,EACf,IAAI,GAAE,MAAM,EAAO,EACnB,OAAO,GAAE,MAAc,EACvB,aAAa,CAAC,EAAE,CAAC,GAChB,OAAO,CAAC,CAAC,SAAS,IAAI,GAAG;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;CAAE,GAAG,MAAM,CAAC,CA4BxE"}
|
|
1
|
+
{"version":3,"file":"shell.d.ts","sourceRoot":"","sources":["../../../lib/commands/shell.ts"],"names":[],"mappings":"AAMA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAsB,WAAW,CAAC,CAAC,SAAS,OAAO,EACjD,OAAO,EAAE,MAAM,EACf,IAAI,GAAE,MAAM,EAAO,EACnB,OAAO,GAAE,MAAc,EACvB,aAAa,CAAC,EAAE,CAAC,GAChB,OAAO,CAAC,CAAC,SAAS,IAAI,GAAG;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;CAAE,GAAG,MAAM,CAAC,CA4BxE"}
|
|
@@ -9,6 +9,27 @@ const driver_1 = require("appium/driver");
|
|
|
9
9
|
const lodash_1 = __importDefault(require("lodash"));
|
|
10
10
|
const teen_process_1 = require("teen_process");
|
|
11
11
|
const utils_1 = require("../utils");
|
|
12
|
+
/**
|
|
13
|
+
* Executes a shell command on the device via ADB.
|
|
14
|
+
*
|
|
15
|
+
* This method runs an arbitrary shell command on the Android device and returns
|
|
16
|
+
* the output. The command is executed using `adb shell` with the specified
|
|
17
|
+
* command and arguments.
|
|
18
|
+
*
|
|
19
|
+
* Requirements:
|
|
20
|
+
* - The adb_shell feature must be enabled
|
|
21
|
+
*
|
|
22
|
+
* @param command The shell command to execute (e.g., 'pm', 'dumpsys', 'getprop').
|
|
23
|
+
* @param args Optional array of command arguments.
|
|
24
|
+
* @param timeout The maximum time in milliseconds to wait for command execution.
|
|
25
|
+
* Defaults to 20000ms (20 seconds).
|
|
26
|
+
* @param includeStderr If `true`, returns both stdout and stderr in an object.
|
|
27
|
+
* If `false` or undefined, returns only stdout as a string.
|
|
28
|
+
* @returns If `includeStderr` is `true`, returns `{ stdout: string, stderr: string }`.
|
|
29
|
+
* Otherwise, returns the command output as a string.
|
|
30
|
+
* @throws {errors.InvalidArgumentError} If `command` is not a string.
|
|
31
|
+
* @throws {Error} If the command execution fails or times out.
|
|
32
|
+
*/
|
|
12
33
|
async function mobileShell(command, args = [], timeout = 20000, includeStderr) {
|
|
13
34
|
this.assertFeatureEnabled(utils_1.ADB_SHELL_FEATURE);
|
|
14
35
|
if (!lodash_1.default.isString(command)) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shell.js","sourceRoot":"","sources":["../../../lib/commands/shell.ts"],"names":[],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"shell.js","sourceRoot":"","sources":["../../../lib/commands/shell.ts"],"names":[],"mappings":";;;;;AA2BA,kCAiCC;AA5DD,6CAAqC;AACrC,0CAAqC;AACrC,oDAAuB;AACvB,+CAAkC;AAClC,oCAA2C;AAE3C;;;;;;;;;;;;;;;;;;;;GAoBG;AACI,KAAK,UAAU,WAAW,CAC/B,OAAe,EACf,OAAiB,EAAE,EACnB,UAAkB,KAAK,EACvB,aAAiB;IAEjB,IAAI,CAAC,oBAAoB,CAAC,yBAAiB,CAAC,CAAC;IAE7C,IAAI,CAAC,gBAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC;QACzB,MAAM,IAAI,eAAM,CAAC,oBAAoB,CAAC,qCAAqC,CAAC,CAAC;IAC/E,CAAC;IAED,MAAM,OAAO,GAAG,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,WAAW,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,gBAAC,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC;IAC7F,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,YAAY,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,IAAI,IAAI,cAAI,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IAC/E,IAAI,CAAC;QACH,MAAM,EAAC,MAAM,EAAE,MAAM,EAAC,GAAG,MAAM,IAAA,mBAAI,EAAC,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,IAAI,EAAE,OAAO,EAAE,EAAC,OAAO,EAAC,CAAC,CAAC;QAClF,IAAI,aAAa,EAAE,CAAC;YAClB,4CAA4C;YAC5C,OAAO;gBACL,MAAM;gBACN,MAAM;aACP,CAAC;QACJ,CAAC;QACD,4CAA4C;QAC5C,OAAO,MAAM,CAAC;IAChB,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,MAAM,GAAG,GAAG,+CAA+C,CAAC,CAAC,CAAC,CAAC,CAAC;QAChE,MAAM,IAAI,CAAC,GAAG,CAAC,kBAAkB,CAC/B,uBAAuB,OAAO,mBAAmB;YAC/C,mBAAmB,GAAG,CAAC,OAAO,IAAI;YAClC,WAAW,GAAG,CAAC,MAAM,aAAa,GAAG,CAAC,MAAM,EAAE,CACjD,CAAC;IACJ,CAAC;AACH,CAAC"}
|
|
@@ -1,84 +1,54 @@
|
|
|
1
|
+
import type { AndroidDriver } from '../driver';
|
|
1
2
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
3
|
+
* Starts a screen streaming session that broadcasts the device screen as an MJPEG stream.
|
|
4
|
+
*
|
|
5
|
+
* This method uses Android's `screenrecord` command to capture the screen and GStreamer
|
|
6
|
+
* to encode it as an MJPEG stream accessible via HTTP. The stream can be viewed in any
|
|
7
|
+
* web browser or MJPEG-compatible client.
|
|
8
|
+
*
|
|
9
|
+
* Requirements:
|
|
10
|
+
* - The device must have the `screenrecord` binary available
|
|
11
|
+
* - The host system must have GStreamer installed with required plugins
|
|
12
|
+
* - The ADB screen streaming feature must be enabled
|
|
13
|
+
*
|
|
14
|
+
* @param width The scaled width of the device's screen.
|
|
4
15
|
* If unset then the script will assign it to the actual screen width measured
|
|
5
16
|
* in pixels.
|
|
6
|
-
* @param
|
|
17
|
+
* @param height The scaled height of the device's screen.
|
|
7
18
|
* If unset then the script will assign it to the actual screen height
|
|
8
19
|
* measured in pixels.
|
|
9
|
-
* @param
|
|
20
|
+
* @param bitRate The video bit rate for the video, in bits per second.
|
|
10
21
|
* The default value is 4 Mb/s. You can increase the bit rate to improve video
|
|
11
22
|
* quality, but doing so results in larger movie files.
|
|
12
|
-
* @param
|
|
23
|
+
* @param host The IP address/host name to start the MJPEG server on.
|
|
13
24
|
* You can set it to `0.0.0.0` to trigger the broadcast on all available
|
|
14
25
|
* network interfaces.
|
|
15
|
-
* @param
|
|
16
|
-
* @param
|
|
17
|
-
* @param
|
|
26
|
+
* @param port The port number to start the MJPEG server on.
|
|
27
|
+
* @param tcpPort The port number to start the internal TCP MJPEG broadcast on.
|
|
28
|
+
* @param pathname The HTTP request path the MJPEG server should be available on.
|
|
18
29
|
* If unset, then any pathname on the given `host`/`port` combination will
|
|
19
30
|
* work. Note that the value should always start with a single slash: `/`
|
|
20
|
-
* @param
|
|
31
|
+
* @param quality The quality value for the streamed JPEG images.
|
|
21
32
|
* This number should be in range `[1,100]`, where `100` is the best quality.
|
|
22
|
-
* @param
|
|
33
|
+
* @param considerRotation If set to `true` then GStreamer pipeline will increase the dimensions of
|
|
23
34
|
* the resulting images to properly fit images in both landscape and portrait
|
|
24
35
|
* orientations.
|
|
25
36
|
* Set it to `true` if the device rotation is not going to be the same during
|
|
26
37
|
* the broadcasting session.
|
|
27
|
-
* @param
|
|
38
|
+
* @param logPipelineDetails Whether to log GStreamer pipeline events into the standard log output.
|
|
28
39
|
* Might be useful for debugging purposes.
|
|
29
|
-
* @
|
|
30
|
-
*/
|
|
31
|
-
export function mobileStartScreenStreaming(this:
|
|
32
|
-
export class mobileStartScreenStreaming {
|
|
33
|
-
/**
|
|
34
|
-
* @this {import('../driver').AndroidDriver}
|
|
35
|
-
* @param {number} [width] The scaled width of the device's screen.
|
|
36
|
-
* If unset then the script will assign it to the actual screen width measured
|
|
37
|
-
* in pixels.
|
|
38
|
-
* @param {number} [height] The scaled height of the device's screen.
|
|
39
|
-
* If unset then the script will assign it to the actual screen height
|
|
40
|
-
* measured in pixels.
|
|
41
|
-
* @param {number} [bitRate=4000000] The video bit rate for the video, in bits per second.
|
|
42
|
-
* The default value is 4 Mb/s. You can increase the bit rate to improve video
|
|
43
|
-
* quality, but doing so results in larger movie files.
|
|
44
|
-
* @param {string} [host='127.0.0.1'] The IP address/host name to start the MJPEG server on.
|
|
45
|
-
* You can set it to `0.0.0.0` to trigger the broadcast on all available
|
|
46
|
-
* network interfaces.
|
|
47
|
-
* @param {number} [port=8093] The port number to start the MJPEG server on.
|
|
48
|
-
* @param {number} [tcpPort=8094] The port number to start the internal TCP MJPEG broadcast on.
|
|
49
|
-
* @param {string} [pathname] The HTTP request path the MJPEG server should be available on.
|
|
50
|
-
* If unset, then any pathname on the given `host`/`port` combination will
|
|
51
|
-
* work. Note that the value should always start with a single slash: `/`
|
|
52
|
-
* @param {number} [quality=70] The quality value for the streamed JPEG images.
|
|
53
|
-
* This number should be in range `[1,100]`, where `100` is the best quality.
|
|
54
|
-
* @param {boolean} [considerRotation=false] If set to `true` then GStreamer pipeline will increase the dimensions of
|
|
55
|
-
* the resulting images to properly fit images in both landscape and portrait
|
|
56
|
-
* orientations.
|
|
57
|
-
* Set it to `true` if the device rotation is not going to be the same during
|
|
58
|
-
* the broadcasting session.
|
|
59
|
-
* @param {boolean} [logPipelineDetails=false] Whether to log GStreamer pipeline events into the standard log output.
|
|
60
|
-
* Might be useful for debugging purposes.
|
|
61
|
-
* @returns {Promise<void>}
|
|
62
|
-
*/
|
|
63
|
-
constructor(this: import("../driver").AndroidDriver, width?: number, height?: number, bitRate?: number, host?: string, port?: number, pathname?: string, tcpPort?: number, quality?: number, considerRotation?: boolean, logPipelineDetails?: boolean);
|
|
64
|
-
_screenStreamingProps: {
|
|
65
|
-
deviceStreamingProc: import("node:child_process").ChildProcessWithoutNullStreams;
|
|
66
|
-
gstreamerPipeline: any;
|
|
67
|
-
mjpegSocket: net.Socket | undefined;
|
|
68
|
-
mjpegServer: http.Server<typeof http.IncomingMessage, typeof http.ServerResponse> | undefined;
|
|
69
|
-
} | undefined;
|
|
70
|
-
}
|
|
40
|
+
* @throws {Error} If streaming requirements are not met, ports are busy, or streaming fails to start.
|
|
41
|
+
*/
|
|
42
|
+
export declare function mobileStartScreenStreaming(this: AndroidDriver, width?: number, height?: number, bitRate?: number, host?: string, port?: number, pathname?: string, tcpPort?: number, quality?: number, considerRotation?: boolean, logPipelineDetails?: boolean): Promise<void>;
|
|
71
43
|
/**
|
|
72
|
-
*
|
|
73
|
-
*
|
|
44
|
+
* Stops the currently running screen streaming session.
|
|
45
|
+
*
|
|
46
|
+
* This method gracefully terminates all processes involved in screen streaming:
|
|
47
|
+
* - The MJPEG HTTP server
|
|
48
|
+
* - The GStreamer pipeline
|
|
49
|
+
* - The device screen recording process
|
|
50
|
+
*
|
|
51
|
+
* If no streaming session is active, this method returns without error.
|
|
74
52
|
*/
|
|
75
|
-
export function mobileStopScreenStreaming(this:
|
|
76
|
-
export class mobileStopScreenStreaming {
|
|
77
|
-
_screenStreamingProps: any;
|
|
78
|
-
}
|
|
79
|
-
export type ADB = import("appium-adb").ADB;
|
|
80
|
-
export type AppiumLogger = import("@appium/types").AppiumLogger;
|
|
81
|
-
export type DeviceInfo = import("./types").DeviceInfo;
|
|
82
|
-
import net from 'node:net';
|
|
83
|
-
import http from 'node:http';
|
|
53
|
+
export declare function mobileStopScreenStreaming(this: AndroidDriver): Promise<void>;
|
|
84
54
|
//# sourceMappingURL=streamscreen.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"streamscreen.d.ts","sourceRoot":"","sources":["../../../lib/commands/streamscreen.
|
|
1
|
+
{"version":3,"file":"streamscreen.d.ts","sourceRoot":"","sources":["../../../lib/commands/streamscreen.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAC,aAAa,EAAC,MAAM,WAAW,CAAC;AA2B7C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,wBAAsB,0BAA0B,CAC9C,IAAI,EAAE,aAAa,EACnB,KAAK,CAAC,EAAE,MAAM,EACd,MAAM,CAAC,EAAE,MAAM,EACf,OAAO,CAAC,EAAE,MAAM,EAChB,IAAI,GAAE,MAAqB,EAC3B,IAAI,GAAE,MAAqB,EAC3B,QAAQ,CAAC,EAAE,MAAM,EACjB,OAAO,GAAE,MAAyB,EAClC,OAAO,GAAE,MAAwB,EACjC,gBAAgB,GAAE,OAAe,EACjC,kBAAkB,GAAE,OAAe,GAClC,OAAO,CAAC,IAAI,CAAC,CAqIf;AAED;;;;;;;;;GASG;AACH,wBAAsB,yBAAyB,CAAC,IAAI,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC,CAmClF"}
|