appium-remote-debugger 11.5.9 → 12.0.1
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 +51 -0
- package/build/lib/mixins/connect.d.ts +2 -45
- package/build/lib/mixins/connect.d.ts.map +1 -1
- package/build/lib/mixins/connect.js +46 -46
- package/build/lib/mixins/connect.js.map +1 -1
- package/build/lib/mixins/cookies.d.ts.map +1 -1
- package/build/lib/mixins/cookies.js +8 -7
- package/build/lib/mixins/cookies.js.map +1 -1
- package/build/lib/mixins/events.d.ts +27 -5
- package/build/lib/mixins/events.d.ts.map +1 -1
- package/build/lib/mixins/events.js +47 -6
- package/build/lib/mixins/events.js.map +1 -1
- package/build/lib/mixins/execute.d.ts.map +1 -1
- package/build/lib/mixins/execute.js +16 -12
- package/build/lib/mixins/execute.js.map +1 -1
- package/build/lib/mixins/message-handlers.d.ts +0 -31
- package/build/lib/mixins/message-handlers.d.ts.map +1 -1
- package/build/lib/mixins/message-handlers.js +21 -22
- package/build/lib/mixins/message-handlers.js.map +1 -1
- package/build/lib/mixins/misc.d.ts +2 -24
- package/build/lib/mixins/misc.d.ts.map +1 -1
- package/build/lib/mixins/misc.js +15 -51
- package/build/lib/mixins/misc.js.map +1 -1
- package/build/lib/mixins/navigate.d.ts +1 -25
- package/build/lib/mixins/navigate.d.ts.map +1 -1
- package/build/lib/mixins/navigate.js +36 -30
- package/build/lib/mixins/navigate.js.map +1 -1
- package/build/lib/mixins/property-accessors.d.ts +27 -0
- package/build/lib/mixins/property-accessors.d.ts.map +1 -0
- package/build/lib/mixins/property-accessors.js +95 -0
- package/build/lib/mixins/property-accessors.js.map +1 -0
- package/build/lib/mixins/screenshot.d.ts.map +1 -1
- package/build/lib/mixins/screenshot.js +3 -2
- package/build/lib/mixins/screenshot.js.map +1 -1
- package/build/lib/remote-debugger-real-device.d.ts +7 -19
- package/build/lib/remote-debugger-real-device.d.ts.map +1 -1
- package/build/lib/remote-debugger-real-device.js +12 -20
- package/build/lib/remote-debugger-real-device.js.map +1 -1
- package/build/lib/remote-debugger.d.ts +63 -167
- package/build/lib/remote-debugger.d.ts.map +1 -1
- package/build/lib/remote-debugger.js +75 -119
- package/build/lib/remote-debugger.js.map +1 -1
- package/build/lib/types.d.ts +41 -1
- package/build/lib/types.d.ts.map +1 -1
- package/build/tsconfig.tsbuildinfo +1 -1
- package/lib/mixins/connect.js +66 -52
- package/lib/mixins/cookies.js +11 -7
- package/lib/mixins/events.js +50 -6
- package/lib/mixins/execute.js +27 -14
- package/lib/mixins/message-handlers.js +30 -23
- package/lib/mixins/misc.js +18 -51
- package/lib/mixins/navigate.js +44 -30
- package/lib/mixins/property-accessors.ts +96 -0
- package/lib/mixins/screenshot.js +7 -2
- package/lib/remote-debugger-real-device.ts +28 -0
- package/lib/remote-debugger.ts +268 -0
- package/lib/types.ts +44 -1
- package/package.json +1 -1
- package/lib/remote-debugger-real-device.js +0 -39
- package/lib/remote-debugger.js +0 -299
package/lib/mixins/misc.js
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import { checkParams } from '../utils';
|
|
2
2
|
import B from 'bluebird';
|
|
3
|
+
import {
|
|
4
|
+
getAppIdKey,
|
|
5
|
+
getPageIdKey,
|
|
6
|
+
} from './property-accessors';
|
|
3
7
|
|
|
4
8
|
const SAFARI_BUNDLE_ID = 'com.apple.mobilesafari';
|
|
5
9
|
const GARBAGE_COLLECT_TIMEOUT_MS = 5000;
|
|
@@ -16,15 +20,15 @@ export async function launchSafari () {
|
|
|
16
20
|
|
|
17
21
|
/**
|
|
18
22
|
* @this {RemoteDebugger}
|
|
19
|
-
* @param {
|
|
23
|
+
* @param {import('../types').EventListener} fn
|
|
20
24
|
* @returns {Promise<any>}
|
|
21
25
|
*/
|
|
22
26
|
export async function startTimeline (fn) {
|
|
23
27
|
this.log.debug('Starting to record the timeline');
|
|
24
28
|
this.requireRpcClient().on('Timeline.eventRecorded', fn);
|
|
25
29
|
return await this.requireRpcClient().send('Timeline.start', {
|
|
26
|
-
appIdKey: this
|
|
27
|
-
pageIdKey: this
|
|
30
|
+
appIdKey: getAppIdKey(this),
|
|
31
|
+
pageIdKey: getPageIdKey(this),
|
|
28
32
|
});
|
|
29
33
|
}
|
|
30
34
|
|
|
@@ -35,51 +39,11 @@ export async function startTimeline (fn) {
|
|
|
35
39
|
export async function stopTimeline () {
|
|
36
40
|
this.log.debug('Stopping to record the timeline');
|
|
37
41
|
await this.requireRpcClient().send('Timeline.stop', {
|
|
38
|
-
appIdKey: this
|
|
39
|
-
pageIdKey: this
|
|
42
|
+
appIdKey: getAppIdKey(this),
|
|
43
|
+
pageIdKey: getPageIdKey(this),
|
|
40
44
|
});
|
|
41
45
|
}
|
|
42
46
|
|
|
43
|
-
/**
|
|
44
|
-
* @this {RemoteDebugger}
|
|
45
|
-
* @param {(event: import('@appium/types').StringRecord) => any} listener
|
|
46
|
-
* @returns {void}
|
|
47
|
-
*/
|
|
48
|
-
export function startConsole (listener) {
|
|
49
|
-
this.log.debug('Starting to listen for JavaScript console');
|
|
50
|
-
this.addClientEventListener('Console.messageAdded', listener);
|
|
51
|
-
this.addClientEventListener('Console.messageRepeatCountUpdated', listener);
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
/**
|
|
55
|
-
* @this {RemoteDebugger}
|
|
56
|
-
* @returns {void}
|
|
57
|
-
*/
|
|
58
|
-
export function stopConsole () {
|
|
59
|
-
this.log.debug('Stopping to listen for JavaScript console');
|
|
60
|
-
this.removeClientEventListener('Console.messageAdded');
|
|
61
|
-
this.removeClientEventListener('Console.messageRepeatCountUpdated');
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
/**
|
|
65
|
-
* @this {RemoteDebugger}
|
|
66
|
-
* @param {(event: import('@appium/types').StringRecord) => any} listener
|
|
67
|
-
* @returns {void}
|
|
68
|
-
*/
|
|
69
|
-
export function startNetwork (listener) {
|
|
70
|
-
this.log.debug('Starting to listen for network events');
|
|
71
|
-
this.addClientEventListener('NetworkEvent', listener);
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
/**
|
|
75
|
-
* @this {RemoteDebugger}
|
|
76
|
-
* @returns {void}
|
|
77
|
-
*/
|
|
78
|
-
export function stopNetwork () {
|
|
79
|
-
this.log.debug('Stopping to listen for network events');
|
|
80
|
-
this.removeClientEventListener('NetworkEvent');
|
|
81
|
-
}
|
|
82
|
-
|
|
83
47
|
// Potentially this does not work for mobile safari
|
|
84
48
|
/**
|
|
85
49
|
* @this {RemoteDebugger}
|
|
@@ -89,9 +53,9 @@ export function stopNetwork () {
|
|
|
89
53
|
export async function overrideUserAgent (value) {
|
|
90
54
|
this.log.debug('Setting overrideUserAgent');
|
|
91
55
|
return await this.requireRpcClient().send('Page.overrideUserAgent', {
|
|
92
|
-
appIdKey: this
|
|
93
|
-
pageIdKey: this
|
|
94
|
-
value
|
|
56
|
+
appIdKey: getAppIdKey(this),
|
|
57
|
+
pageIdKey: getPageIdKey(this),
|
|
58
|
+
value,
|
|
95
59
|
});
|
|
96
60
|
}
|
|
97
61
|
|
|
@@ -104,7 +68,10 @@ export async function garbageCollect (timeoutMs = GARBAGE_COLLECT_TIMEOUT_MS) {
|
|
|
104
68
|
this.log.debug(`Garbage collecting with ${timeoutMs}ms timeout`);
|
|
105
69
|
|
|
106
70
|
try {
|
|
107
|
-
checkParams({
|
|
71
|
+
checkParams({
|
|
72
|
+
appIdKey: getAppIdKey(this),
|
|
73
|
+
pageIdKey: getPageIdKey(this),
|
|
74
|
+
});
|
|
108
75
|
} catch (err) {
|
|
109
76
|
this.log.debug(`Unable to collect garbage at this time`);
|
|
110
77
|
return;
|
|
@@ -113,8 +80,8 @@ export async function garbageCollect (timeoutMs = GARBAGE_COLLECT_TIMEOUT_MS) {
|
|
|
113
80
|
try {
|
|
114
81
|
await B.resolve(this.requireRpcClient().send(
|
|
115
82
|
'Heap.gc', {
|
|
116
|
-
appIdKey: this
|
|
117
|
-
pageIdKey: this
|
|
83
|
+
appIdKey: getAppIdKey(this),
|
|
84
|
+
pageIdKey: getPageIdKey(this),
|
|
118
85
|
})
|
|
119
86
|
).timeout(timeoutMs);
|
|
120
87
|
this.log.debug(`Garbage collection successful`);
|
package/lib/mixins/navigate.js
CHANGED
|
@@ -5,8 +5,18 @@ import _ from 'lodash';
|
|
|
5
5
|
import B from 'bluebird';
|
|
6
6
|
import { errors } from '@appium/base-driver';
|
|
7
7
|
import { rpcConstants } from '../rpc';
|
|
8
|
+
import {
|
|
9
|
+
getAppIdKey,
|
|
10
|
+
setPageLoading,
|
|
11
|
+
getPageLoadDelay,
|
|
12
|
+
getPageLoadStartegy,
|
|
13
|
+
setPageLoadDelay,
|
|
14
|
+
getPageReadyTimeout,
|
|
15
|
+
getPageIdKey,
|
|
16
|
+
setNavigatingToPage,
|
|
17
|
+
} from './property-accessors';
|
|
8
18
|
|
|
9
|
-
const DEFAULT_PAGE_READINESS_TIMEOUT_MS = 20 * 1000;
|
|
19
|
+
export const DEFAULT_PAGE_READINESS_TIMEOUT_MS = 20 * 1000;
|
|
10
20
|
const PAGE_READINESS_CHECK_INTERVAL_MS = 50;
|
|
11
21
|
const PAGE_READINESS_JS_MIN_CHECK_INTERVAL_MS = 1000;
|
|
12
22
|
const CONSOLE_ENABLEMENT_TIMEOUT_MS = 20 * 1000;
|
|
@@ -34,10 +44,8 @@ export function frameDetached () {
|
|
|
34
44
|
*/
|
|
35
45
|
export function cancelPageLoad () {
|
|
36
46
|
this.log.debug('Unregistering from page readiness notifications');
|
|
37
|
-
this
|
|
38
|
-
|
|
39
|
-
this.pageLoadDelay.cancel();
|
|
40
|
-
}
|
|
47
|
+
setPageLoading(this, false);
|
|
48
|
+
getPageLoadDelay(this)?.cancel();
|
|
41
49
|
}
|
|
42
50
|
|
|
43
51
|
/**
|
|
@@ -49,7 +57,7 @@ export function cancelPageLoad () {
|
|
|
49
57
|
* @returns {boolean}
|
|
50
58
|
*/
|
|
51
59
|
export function isPageLoadingCompleted (readyState) {
|
|
52
|
-
const _pageLoadStrategy = _.toLower(this
|
|
60
|
+
const _pageLoadStrategy = _.toLower(getPageLoadStartegy(this));
|
|
53
61
|
if (_pageLoadStrategy === PAGE_LOAD_STRATEGY.NONE) {
|
|
54
62
|
return true;
|
|
55
63
|
}
|
|
@@ -70,15 +78,15 @@ export function isPageLoadingCompleted (readyState) {
|
|
|
70
78
|
*/
|
|
71
79
|
export async function waitForDom (startPageLoadTimer) {
|
|
72
80
|
this.log.debug('Waiting for page readiness');
|
|
73
|
-
const readinessTimeoutMs = this.pageLoadMs
|
|
81
|
+
const readinessTimeoutMs = this.pageLoadMs;
|
|
74
82
|
if (!_.isFunction(startPageLoadTimer?.getDuration)) {
|
|
75
83
|
this.log.debug(`Page load timer not a timer. Creating new timer`);
|
|
76
84
|
startPageLoadTimer = new timing.Timer().start();
|
|
77
85
|
}
|
|
78
86
|
|
|
79
87
|
let isPageLoading = true;
|
|
80
|
-
this
|
|
81
|
-
this
|
|
88
|
+
setPageLoading(this, true);
|
|
89
|
+
setPageLoadDelay(this, util.cancellableDelay(readinessTimeoutMs));
|
|
82
90
|
/** @type {B<void>} */
|
|
83
91
|
const pageReadinessPromise = B.resolve((async () => {
|
|
84
92
|
let retry = 0;
|
|
@@ -93,7 +101,7 @@ export async function waitForDom (startPageLoadTimer) {
|
|
|
93
101
|
);
|
|
94
102
|
await B.delay(intervalMs);
|
|
95
103
|
// we can get this called in the middle of trying to find a new app
|
|
96
|
-
if (!this
|
|
104
|
+
if (!getAppIdKey(this)) {
|
|
97
105
|
this.log.debug('Not connected to an application. Ignoring page readiess check');
|
|
98
106
|
return;
|
|
99
107
|
}
|
|
@@ -119,7 +127,7 @@ export async function waitForDom (startPageLoadTimer) {
|
|
|
119
127
|
/** @type {B<void>} */
|
|
120
128
|
const cancellationPromise = B.resolve((async () => {
|
|
121
129
|
try {
|
|
122
|
-
await this
|
|
130
|
+
await getPageLoadDelay(this);
|
|
123
131
|
} catch (ign) {}
|
|
124
132
|
})());
|
|
125
133
|
|
|
@@ -127,8 +135,8 @@ export async function waitForDom (startPageLoadTimer) {
|
|
|
127
135
|
await B.any([cancellationPromise, pageReadinessPromise]);
|
|
128
136
|
} finally {
|
|
129
137
|
isPageLoading = false;
|
|
130
|
-
this
|
|
131
|
-
this
|
|
138
|
+
setPageLoading(this, false);
|
|
139
|
+
setPageLoadDelay(this, B.resolve());
|
|
132
140
|
}
|
|
133
141
|
}
|
|
134
142
|
|
|
@@ -138,20 +146,23 @@ export async function waitForDom (startPageLoadTimer) {
|
|
|
138
146
|
* @returns {Promise<boolean>}
|
|
139
147
|
*/
|
|
140
148
|
export async function checkPageIsReady (timeoutMs) {
|
|
141
|
-
checkParams({
|
|
149
|
+
checkParams({
|
|
150
|
+
appIdKey: getAppIdKey(this),
|
|
151
|
+
});
|
|
142
152
|
|
|
143
153
|
const readyCmd = 'document.readyState;';
|
|
154
|
+
const actualTimeoutMs = timeoutMs ?? getPageReadyTimeout(this);
|
|
144
155
|
try {
|
|
145
156
|
const readyState = await B.resolve(this.execute(readyCmd, true))
|
|
146
|
-
.timeout(
|
|
157
|
+
.timeout(actualTimeoutMs);
|
|
147
158
|
this.log.debug(`Document readyState is '${readyState}'. ` +
|
|
148
|
-
`The pageLoadStrategy is '${this
|
|
159
|
+
`The pageLoadStrategy is '${getPageLoadStartegy(this) ?? PAGE_LOAD_STRATEGY.NORMAL}'`);
|
|
149
160
|
return this.isPageLoadingCompleted(readyState);
|
|
150
161
|
} catch (err) {
|
|
151
162
|
if (!(err instanceof B.TimeoutError)) {
|
|
152
163
|
throw err;
|
|
153
164
|
}
|
|
154
|
-
this.log.debug(`Page readiness check timed out after ${
|
|
165
|
+
this.log.debug(`Page readiness check timed out after ${actualTimeoutMs}ms`);
|
|
155
166
|
return false;
|
|
156
167
|
}
|
|
157
168
|
}
|
|
@@ -162,7 +173,10 @@ export async function checkPageIsReady (timeoutMs) {
|
|
|
162
173
|
* @returns {Promise<void>}
|
|
163
174
|
*/
|
|
164
175
|
export async function navToUrl (url) {
|
|
165
|
-
checkParams({
|
|
176
|
+
checkParams({
|
|
177
|
+
appIdKey: getAppIdKey(this),
|
|
178
|
+
pageIdKey: getPageIdKey(this),
|
|
179
|
+
});
|
|
166
180
|
const rpcClient = this.requireRpcClient();
|
|
167
181
|
|
|
168
182
|
try {
|
|
@@ -171,17 +185,17 @@ export async function navToUrl (url) {
|
|
|
171
185
|
throw new TypeError(`'${url}' is not a valid URL`);
|
|
172
186
|
}
|
|
173
187
|
|
|
174
|
-
this
|
|
188
|
+
setNavigatingToPage(this, true);
|
|
175
189
|
this.log.debug(`Navigating to new URL: '${url}'`);
|
|
176
|
-
const readinessTimeoutMs = this.pageLoadMs
|
|
190
|
+
const readinessTimeoutMs = this.pageLoadMs;
|
|
177
191
|
/** @type {(() => void)|undefined} */
|
|
178
192
|
let onPageLoaded;
|
|
179
193
|
/** @type {(() => void)|undefined} */
|
|
180
194
|
let onTargetProvisioned;
|
|
181
195
|
/** @type {NodeJS.Timeout|undefined|null} */
|
|
182
196
|
let onPageLoadedTimeout;
|
|
183
|
-
this
|
|
184
|
-
this
|
|
197
|
+
setPageLoadDelay(this, util.cancellableDelay(readinessTimeoutMs));
|
|
198
|
+
setPageLoading(this, true);
|
|
185
199
|
let isPageLoading = true;
|
|
186
200
|
let didPageFinishLoad = false;
|
|
187
201
|
const start = new timing.Timer().start();
|
|
@@ -236,24 +250,24 @@ export async function navToUrl (url) {
|
|
|
236
250
|
|
|
237
251
|
rpcClient.send('Page.navigate', {
|
|
238
252
|
url,
|
|
239
|
-
appIdKey: this
|
|
240
|
-
pageIdKey: this
|
|
253
|
+
appIdKey: getAppIdKey(this),
|
|
254
|
+
pageIdKey: getPageIdKey(this),
|
|
241
255
|
});
|
|
242
256
|
});
|
|
243
257
|
/** @type {B<void>} */
|
|
244
258
|
const cancellationPromise = B.resolve((async () => {
|
|
245
259
|
try {
|
|
246
|
-
await this
|
|
260
|
+
await getPageLoadDelay(this);
|
|
247
261
|
} catch (ign) {}
|
|
248
262
|
})());
|
|
249
263
|
|
|
250
264
|
try {
|
|
251
265
|
await B.any([cancellationPromise, pageReadinessPromise]);
|
|
252
266
|
} finally {
|
|
253
|
-
this
|
|
267
|
+
setPageLoading(this, false);
|
|
254
268
|
isPageLoading = false;
|
|
255
|
-
this
|
|
256
|
-
this
|
|
269
|
+
setNavigatingToPage(this, false);
|
|
270
|
+
setPageLoadDelay(this, B.resolve());
|
|
257
271
|
if (onPageLoadedTimeout && pageReadinessPromise.isFulfilled()) {
|
|
258
272
|
clearTimeout(onPageLoadedTimeout);
|
|
259
273
|
onPageLoadedTimeout = null;
|
|
@@ -270,8 +284,8 @@ export async function navToUrl (url) {
|
|
|
270
284
|
// get notified when navigating to a local page
|
|
271
285
|
try {
|
|
272
286
|
await B.resolve(rpcClient.send('Console.enable', {
|
|
273
|
-
appIdKey: this
|
|
274
|
-
pageIdKey: this
|
|
287
|
+
appIdKey: getAppIdKey(this),
|
|
288
|
+
pageIdKey: getPageIdKey(this),
|
|
275
289
|
}, didPageFinishLoad)).timeout(CONSOLE_ENABLEMENT_TIMEOUT_MS);
|
|
276
290
|
} catch (err) {
|
|
277
291
|
if (err instanceof B.TimeoutError) {
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
/* eslint-disable dot-notation */
|
|
2
|
+
import type { StringRecord } from '@appium/types';
|
|
3
|
+
import type { RemoteDebugger } from '../remote-debugger';
|
|
4
|
+
import type { EventListener } from '../types';
|
|
5
|
+
|
|
6
|
+
export function getAppDict(instance: RemoteDebugger): typeof instance['_appDict'] {
|
|
7
|
+
return instance['_appDict'];
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export function getAppIdKey(instance: RemoteDebugger): typeof instance['_appIdKey'] {
|
|
11
|
+
return instance['_appIdKey'];
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export function setAppIdKey(instance: RemoteDebugger, value: typeof instance['_appIdKey']): void {
|
|
15
|
+
instance['_appIdKey'] = value;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export function getRcpClient(instance: RemoteDebugger): typeof instance['_rpcClient'] {
|
|
19
|
+
return instance['_rpcClient'];
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export function getPageIdKey(instance: RemoteDebugger): typeof instance['_pageIdKey'] {
|
|
23
|
+
return instance['_pageIdKey'];
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export function setPageIdKey(instance: RemoteDebugger, value: typeof instance['_pageIdKey']): void {
|
|
27
|
+
instance['_pageIdKey'] = value;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export function getIsSafari(instance: RemoteDebugger): typeof instance['_isSafari'] {
|
|
31
|
+
return instance['_isSafari'];
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export function getIncludeSafari(instance: RemoteDebugger): typeof instance['_includeSafari'] {
|
|
35
|
+
return instance['_includeSafari'];
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export function getBundleId(instance: RemoteDebugger): typeof instance['_bundleId'] {
|
|
39
|
+
return instance['_bundleId'];
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export function getAdditionalBundleIds(instance: RemoteDebugger): typeof instance['_additionalBundleIds'] {
|
|
43
|
+
return instance['_additionalBundleIds'];
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export function getSkippedApps(instance: RemoteDebugger): typeof instance['_skippedApps'] {
|
|
47
|
+
return instance['_skippedApps'];
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export function getClientEventListeners(instance: RemoteDebugger): StringRecord<EventListener[]> {
|
|
51
|
+
return instance['_clientEventListeners'];
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export function getPageLoading(instance: RemoteDebugger): boolean {
|
|
55
|
+
return instance['_pageLoading'];
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export function setPageLoading(instance: RemoteDebugger, value: boolean): void {
|
|
59
|
+
instance['_pageLoading'] = value;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export function getGarbageCollectOnExecute(instance: RemoteDebugger): typeof instance['_garbageCollectOnExecute'] {
|
|
63
|
+
return instance['_garbageCollectOnExecute'];
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export function getNavigatingToPage(instance: RemoteDebugger): typeof instance['_navigatingToPage'] {
|
|
67
|
+
return instance['_navigatingToPage'];
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export function setNavigatingToPage(instance: RemoteDebugger, value: typeof instance['_navigatingToPage']): void {
|
|
71
|
+
instance['_navigatingToPage'] = value;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export function setCurrentState(instance: RemoteDebugger, value: typeof instance['_currentState']): void {
|
|
75
|
+
instance['_currentState'] = value;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export function setConnectedDrivers(instance: RemoteDebugger, value: typeof instance['_connectedDrivers']): void {
|
|
79
|
+
instance['_connectedDrivers'] = value;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
export function getPageLoadDelay(instance: RemoteDebugger): typeof instance['_pageLoadDelay'] {
|
|
83
|
+
return instance['_pageLoadDelay'];
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export function setPageLoadDelay(instance: RemoteDebugger, value: typeof instance['_pageLoadDelay']): void {
|
|
87
|
+
instance['_pageLoadDelay'] = value;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
export function getPageLoadStartegy(instance: RemoteDebugger): typeof instance['_pageLoadStrategy'] {
|
|
91
|
+
return instance['_pageLoadStrategy'];
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
export function getPageReadyTimeout(instance: RemoteDebugger): typeof instance['_pageReadyTimeout'] {
|
|
95
|
+
return instance['_pageReadyTimeout'];
|
|
96
|
+
}
|
package/lib/mixins/screenshot.js
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
import {
|
|
2
|
+
getAppIdKey,
|
|
3
|
+
getPageIdKey,
|
|
4
|
+
} from './property-accessors';
|
|
5
|
+
|
|
1
6
|
/**
|
|
2
7
|
* Capture a rect of the page or by default the viewport
|
|
3
8
|
* @this {RemoteDebugger}
|
|
@@ -15,8 +20,8 @@ export async function captureScreenshot(opts = {}) {
|
|
|
15
20
|
));
|
|
16
21
|
const response = await this.requireRpcClient().send('Page.snapshotRect', {
|
|
17
22
|
...arect,
|
|
18
|
-
appIdKey: this
|
|
19
|
-
pageIdKey: this
|
|
23
|
+
appIdKey: getAppIdKey(this),
|
|
24
|
+
pageIdKey: getPageIdKey(this),
|
|
20
25
|
coordinateSystem,
|
|
21
26
|
});
|
|
22
27
|
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import RemoteDebugger from './remote-debugger';
|
|
2
|
+
import { RpcClientRealDevice } from './rpc';
|
|
3
|
+
import type { RemoteDebuggerRealDeviceOptions } from './types';
|
|
4
|
+
|
|
5
|
+
export class RemoteDebuggerRealDevice extends RemoteDebugger {
|
|
6
|
+
private readonly _udid: string;
|
|
7
|
+
|
|
8
|
+
constructor (opts: RemoteDebuggerRealDeviceOptions) {
|
|
9
|
+
super(opts);
|
|
10
|
+
this._udid = opts.udid;
|
|
11
|
+
this._skippedApps = ['lockdownd'];
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
override initRpcClient (): void {
|
|
15
|
+
this._rpcClient = new RpcClientRealDevice({
|
|
16
|
+
bundleId: this._bundleId,
|
|
17
|
+
platformVersion: this._platformVersion,
|
|
18
|
+
isSafari: this._isSafari,
|
|
19
|
+
logAllCommunication: this._logAllCommunication,
|
|
20
|
+
logAllCommunicationHexDump: this._logAllCommunicationHexDump,
|
|
21
|
+
socketChunkSize: this._socketChunkSize,
|
|
22
|
+
webInspectorMaxFrameLength: this._webInspectorMaxFrameLength,
|
|
23
|
+
udid: this._udid,
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export default RemoteDebuggerRealDevice;
|