assistsx-js 0.2.1 → 0.2.3
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/README.md +50 -2
- package/dist/index.cjs +483 -358
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +616 -1717
- package/dist/index.d.ts +616 -1717
- package/dist/index.global.js +3 -1
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +480 -358
- package/dist/index.js.map +1 -1
- package/dist/step-DnFA4DEb.d.mts +1196 -0
- package/dist/step-DnFA4DEb.d.ts +1196 -0
- package/dist/step-flow/index.cjs +4367 -0
- package/dist/step-flow/index.cjs.map +1 -0
- package/dist/step-flow/index.d.mts +83 -0
- package/dist/step-flow/index.d.ts +83 -0
- package/dist/step-flow/index.js +4331 -0
- package/dist/step-flow/index.js.map +1 -0
- package/package.json +6 -1
- package/src/assistsx-async.ts +83 -8
- package/src/assistsx.ts +54 -11
- package/src/index.ts +2 -0
- package/src/log/log.ts +20 -0
- package/src/node-lookup-scope.ts +10 -0
- package/src/pinia-ensure.ts +15 -0
- package/src/step-async.ts +71 -9
- package/src/step-flow/index.ts +5 -0
- package/src/step-flow/legacy-handoff.ts +50 -0
- package/src/step-flow/outcome.ts +16 -0
- package/src/step-flow/payload.ts +23 -0
- package/src/step-flow/runner.ts +128 -0
- package/src/step-flow/types.ts +41 -0
- package/src/step.ts +90 -24
package/dist/index.d.ts
CHANGED
|
@@ -1,1954 +1,818 @@
|
|
|
1
|
+
import { N as Node, a as NodeLookupScope, B as Bounds } from './step-DnFA4DEb.js';
|
|
2
|
+
export { b as NODE_LOOKUP_SCOPE_ACTIVE_WINDOW, c as NODE_LOOKUP_SCOPE_ALL_WINDOWS, d as NodeAsync, S as Step, e as StepAsync, f as StepData, g as StepError, h as StepImpl, i as StepInterceptor, j as StepResult, k as StepStopError } from './step-DnFA4DEb.js';
|
|
1
3
|
import * as pinia from 'pinia';
|
|
2
4
|
|
|
3
|
-
declare class
|
|
4
|
-
readonly
|
|
5
|
-
readonly
|
|
6
|
-
readonly
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
readonly exactCenterX: number;
|
|
13
|
-
readonly exactCenterY: number;
|
|
14
|
-
readonly isEmpty: boolean;
|
|
15
|
-
constructor(left: number, top: number, right: number, bottom: number, width: number, height: number, centerX: number, centerY: number, exactCenterX: number, exactCenterY: number, isEmpty: boolean);
|
|
16
|
-
/**
|
|
17
|
-
* 判断该 Bounds 是否在屏幕内(满足基本几何有效性)
|
|
18
|
-
* @returns {boolean}
|
|
19
|
-
*/
|
|
20
|
-
isInScreen(): boolean;
|
|
21
|
-
static from(data: {
|
|
22
|
-
left: number;
|
|
23
|
-
top: number;
|
|
24
|
-
right: number;
|
|
25
|
-
bottom: number;
|
|
26
|
-
width: number;
|
|
27
|
-
height: number;
|
|
28
|
-
centerX: number;
|
|
29
|
-
centerY: number;
|
|
30
|
-
exactCenterX: number;
|
|
31
|
-
exactCenterY: number;
|
|
32
|
-
isEmpty: boolean;
|
|
33
|
-
}): Bounds;
|
|
34
|
-
static fromJSON(json: string): Bounds;
|
|
35
|
-
static fromData(data: any): Bounds;
|
|
36
|
-
toJSON(): {
|
|
37
|
-
left: number;
|
|
38
|
-
top: number;
|
|
39
|
-
right: number;
|
|
40
|
-
bottom: number;
|
|
41
|
-
width: number;
|
|
42
|
-
height: number;
|
|
43
|
-
centerX: number;
|
|
44
|
-
centerY: number;
|
|
45
|
-
exactCenterX: number;
|
|
46
|
-
exactCenterY: number;
|
|
47
|
-
isEmpty: boolean;
|
|
48
|
-
};
|
|
49
|
-
clone(): Bounds;
|
|
5
|
+
declare class CallResponse {
|
|
6
|
+
readonly code: number;
|
|
7
|
+
readonly data: any | null;
|
|
8
|
+
readonly callbackId: string | null;
|
|
9
|
+
constructor(code: number, data: any | null, callbackId: string | null);
|
|
10
|
+
isSuccess(): boolean;
|
|
11
|
+
getData(): any | null;
|
|
12
|
+
getDataOrNull(): any | null;
|
|
13
|
+
getDataOrDefault(defaultValue: any): any;
|
|
50
14
|
}
|
|
51
15
|
|
|
52
16
|
/**
|
|
53
|
-
*
|
|
54
|
-
*
|
|
17
|
+
* AccessibilityEvent过滤配置接口
|
|
18
|
+
* 用于配置AccessibilityEvent的处理方式和过滤条件
|
|
55
19
|
*/
|
|
56
|
-
|
|
57
|
-
declare class NodeAsync {
|
|
58
|
-
private node;
|
|
20
|
+
interface AccessibilityEventFilterConfig {
|
|
59
21
|
/**
|
|
60
|
-
*
|
|
61
|
-
*
|
|
22
|
+
* 包名过滤
|
|
23
|
+
* 如果为空或null,则处理所有包的事件
|
|
24
|
+
* 如果指定包名,则只处理该包的事件
|
|
62
25
|
*/
|
|
63
|
-
|
|
26
|
+
packageName?: string | null;
|
|
64
27
|
/**
|
|
65
|
-
*
|
|
66
|
-
*
|
|
67
|
-
*
|
|
28
|
+
* 是否在子线程中处理AccessibilityEvent
|
|
29
|
+
* true: 在子线程中处理,避免阻塞主线程
|
|
30
|
+
* false: 在主线程中处理
|
|
68
31
|
*/
|
|
69
|
-
|
|
32
|
+
processInBackground?: boolean;
|
|
70
33
|
/**
|
|
71
|
-
*
|
|
72
|
-
*
|
|
73
|
-
*
|
|
74
|
-
* @param switchWindowIntervalDelay 窗口切换延迟
|
|
75
|
-
* @param clickDuration 点击持续时间
|
|
76
|
-
* @returns 是否点击成功
|
|
34
|
+
* 是否获取节点信息
|
|
35
|
+
* true: 获取并解析AccessibilityNodeInfo节点信息
|
|
36
|
+
* false: 不获取节点信息,提高处理性能
|
|
77
37
|
*/
|
|
78
|
-
|
|
79
|
-
offsetX?: number;
|
|
80
|
-
offsetY?: number;
|
|
81
|
-
switchWindowIntervalDelay?: number;
|
|
82
|
-
clickDuration?: number;
|
|
83
|
-
}): Promise<boolean>;
|
|
38
|
+
fetchNodeInfo?: boolean;
|
|
84
39
|
/**
|
|
85
|
-
*
|
|
86
|
-
*
|
|
87
|
-
*
|
|
88
|
-
* @param switchWindowIntervalDelay 窗口切换延迟
|
|
89
|
-
* @param clickDuration 点击持续时间
|
|
90
|
-
* @param clickInterval 点击间隔
|
|
91
|
-
* @returns 是否双击成功
|
|
40
|
+
* 是否启用日志输出
|
|
41
|
+
* true: 输出AccessibilityEvent处理日志
|
|
42
|
+
* false: 不输出日志
|
|
92
43
|
*/
|
|
93
|
-
|
|
94
|
-
offsetX?: number;
|
|
95
|
-
offsetY?: number;
|
|
96
|
-
switchWindowIntervalDelay?: number;
|
|
97
|
-
clickDuration?: number;
|
|
98
|
-
clickInterval?: number;
|
|
99
|
-
}): Promise<boolean>;
|
|
100
|
-
longPressNodeByGestureAutoPaste(text: string, { matchedPackageName, matchedText, timeoutMillis, longPressDuration, }?: {
|
|
101
|
-
matchedPackageName?: string;
|
|
102
|
-
matchedText?: string;
|
|
103
|
-
timeoutMillis?: number;
|
|
104
|
-
longPressDuration?: number;
|
|
105
|
-
}): Promise<boolean>;
|
|
44
|
+
enableLogging?: boolean;
|
|
106
45
|
/**
|
|
107
|
-
*
|
|
108
|
-
*
|
|
109
|
-
*
|
|
110
|
-
* @param filterViewId 视图ID过滤
|
|
111
|
-
* @param filterDes 描述过滤
|
|
112
|
-
* @returns 节点数组
|
|
46
|
+
* 事件类型过滤
|
|
47
|
+
* 如果为空,则处理所有类型的事件
|
|
48
|
+
* 如果指定类型,则只处理指定类型的事件
|
|
113
49
|
*/
|
|
114
|
-
|
|
115
|
-
filterText?: string;
|
|
116
|
-
filterViewId?: string;
|
|
117
|
-
filterDes?: string;
|
|
118
|
-
}): Promise<Node[]>;
|
|
50
|
+
eventTypes?: number[] | null;
|
|
119
51
|
/**
|
|
120
|
-
*
|
|
121
|
-
*
|
|
122
|
-
*
|
|
123
|
-
* @param filterText 文本过滤
|
|
124
|
-
* @param filterDes 描述过滤
|
|
125
|
-
* @returns 节点数组
|
|
52
|
+
* 是否启用事件去重
|
|
53
|
+
* true: 启用去重,避免重复处理相同事件
|
|
54
|
+
* false: 不启用去重
|
|
126
55
|
*/
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
56
|
+
enableDeduplication?: boolean;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* AccessibilityEvent过滤配置类
|
|
60
|
+
* 用于配置AccessibilityEvent的处理方式和过滤条件
|
|
61
|
+
*/
|
|
62
|
+
declare class AccessibilityEventFilter {
|
|
132
63
|
/**
|
|
133
|
-
*
|
|
134
|
-
* @param text 要查找的文本
|
|
135
|
-
* @param filterClass 类名过滤
|
|
136
|
-
* @param filterViewId 视图ID过滤
|
|
137
|
-
* @param filterDes 描述过滤
|
|
138
|
-
* @returns 节点数组
|
|
64
|
+
* 包名过滤
|
|
139
65
|
*/
|
|
140
|
-
|
|
141
|
-
filterClass?: string;
|
|
142
|
-
filterViewId?: string;
|
|
143
|
-
filterDes?: string;
|
|
144
|
-
}): Promise<Node[]>;
|
|
66
|
+
readonly packageName: string | null;
|
|
145
67
|
/**
|
|
146
|
-
*
|
|
147
|
-
* @returns 是否滚动成功
|
|
68
|
+
* 是否在子线程中处理AccessibilityEvent
|
|
148
69
|
*/
|
|
149
|
-
|
|
70
|
+
readonly processInBackground: boolean;
|
|
150
71
|
/**
|
|
151
|
-
*
|
|
152
|
-
* @returns 是否滚动成功
|
|
72
|
+
* 是否获取节点信息
|
|
153
73
|
*/
|
|
154
|
-
|
|
74
|
+
readonly fetchNodeInfo: boolean;
|
|
155
75
|
/**
|
|
156
|
-
*
|
|
157
|
-
* @param compareNode 比较节点
|
|
158
|
-
* @param isFullyByCompareNode 是否完全可见
|
|
159
|
-
* @returns 是否可见
|
|
76
|
+
* 是否启用日志输出
|
|
160
77
|
*/
|
|
161
|
-
|
|
162
|
-
compareNode?: Node;
|
|
163
|
-
isFullyByCompareNode?: boolean;
|
|
164
|
-
}): Promise<boolean>;
|
|
78
|
+
readonly enableLogging: boolean;
|
|
165
79
|
/**
|
|
166
|
-
*
|
|
167
|
-
* @param overlayHiddenScreenshotDelayMillis 截图延迟时间(毫秒)
|
|
168
|
-
* @returns 截图路径
|
|
80
|
+
* 事件类型过滤
|
|
169
81
|
*/
|
|
170
|
-
|
|
82
|
+
readonly eventTypes?: number[] | null;
|
|
171
83
|
/**
|
|
172
|
-
*
|
|
173
|
-
* @param text 要设置的文本
|
|
174
|
-
* @returns 是否设置成功
|
|
84
|
+
* 是否启用事件去重
|
|
175
85
|
*/
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
focus(): Promise<boolean>;
|
|
86
|
+
readonly enableDeduplication: boolean;
|
|
87
|
+
constructor(config?: AccessibilityEventFilterConfig);
|
|
179
88
|
/**
|
|
180
|
-
*
|
|
181
|
-
* @
|
|
89
|
+
* 检查是否应该处理指定包的事件
|
|
90
|
+
* @param targetPackageName 目标包名
|
|
91
|
+
* @returns true表示应该处理,false表示应该过滤
|
|
182
92
|
*/
|
|
183
|
-
|
|
93
|
+
shouldProcessPackage(targetPackageName: string | null): boolean;
|
|
184
94
|
/**
|
|
185
|
-
*
|
|
186
|
-
* @
|
|
95
|
+
* 检查是否应该处理指定类型的事件
|
|
96
|
+
* @param eventType 事件类型
|
|
97
|
+
* @returns true表示应该处理,false表示应该过滤
|
|
187
98
|
*/
|
|
188
|
-
|
|
99
|
+
shouldProcessEventType(eventType: number): boolean;
|
|
189
100
|
/**
|
|
190
|
-
*
|
|
191
|
-
*
|
|
101
|
+
* 创建默认的过滤配置
|
|
102
|
+
* 所有包名,子线程处理,获取节点信息,启用日志
|
|
192
103
|
*/
|
|
193
|
-
|
|
104
|
+
static createDefault(): AccessibilityEventFilter;
|
|
194
105
|
/**
|
|
195
|
-
*
|
|
196
|
-
*
|
|
106
|
+
* 创建高性能配置
|
|
107
|
+
* 不获取节点信息,不启用日志,启用去重
|
|
197
108
|
*/
|
|
198
|
-
|
|
109
|
+
static createHighPerformance(): AccessibilityEventFilter;
|
|
199
110
|
/**
|
|
200
|
-
*
|
|
201
|
-
*
|
|
111
|
+
* 创建调试配置
|
|
112
|
+
* 启用所有功能,便于调试
|
|
202
113
|
*/
|
|
203
|
-
|
|
114
|
+
static createDebug(): AccessibilityEventFilter;
|
|
204
115
|
/**
|
|
205
|
-
*
|
|
206
|
-
* @
|
|
207
|
-
*/
|
|
208
|
-
getChildren(): Promise<Node[]>;
|
|
209
|
-
/**
|
|
210
|
-
* 从JSON字符串创建节点实例
|
|
211
|
-
* @param json JSON字符串
|
|
212
|
-
* @returns 节点实例
|
|
213
|
-
*/
|
|
214
|
-
static fromJSON(json: string): Node;
|
|
215
|
-
/**
|
|
216
|
-
* 从普通对象创建节点实例
|
|
217
|
-
* @param data 对象数据
|
|
218
|
-
* @returns 节点实例
|
|
219
|
-
*/
|
|
220
|
-
static from(data: any): Node;
|
|
221
|
-
/**
|
|
222
|
-
* JSON.parse的reviver函数,用于将解析的JSON对象转换为Node实例
|
|
223
|
-
* @param key 属性键
|
|
224
|
-
* @param value 属性值
|
|
225
|
-
* @returns 转换后的值
|
|
226
|
-
*/
|
|
227
|
-
static reviver(key: string, value: any): any;
|
|
228
|
-
/**
|
|
229
|
-
* 创建新的节点实例
|
|
230
|
-
* @param params 节点参数对象
|
|
231
|
-
* @returns 节点实例
|
|
232
|
-
*/
|
|
233
|
-
static create(params: {
|
|
234
|
-
nodeId: string;
|
|
235
|
-
text: string;
|
|
236
|
-
des: string;
|
|
237
|
-
viewId: string;
|
|
238
|
-
className: string;
|
|
239
|
-
isScrollable: boolean;
|
|
240
|
-
isClickable: boolean;
|
|
241
|
-
isEnabled: boolean;
|
|
242
|
-
stepId: string | undefined;
|
|
243
|
-
hintText: string;
|
|
244
|
-
isCheckable: boolean;
|
|
245
|
-
isChecked: boolean;
|
|
246
|
-
isFocusable: boolean;
|
|
247
|
-
isFocused: boolean;
|
|
248
|
-
isLongClickable: boolean;
|
|
249
|
-
isPassword: boolean;
|
|
250
|
-
isSelected: boolean;
|
|
251
|
-
isVisibleToUser: boolean;
|
|
252
|
-
drawingOrder: number;
|
|
253
|
-
bounds?: Bounds;
|
|
254
|
-
/** @deprecated 请使用 bounds 替代 */
|
|
255
|
-
boundsInScreen?: Bounds;
|
|
256
|
-
}): Node;
|
|
257
|
-
/**
|
|
258
|
-
* 从JSON数组创建节点数组
|
|
259
|
-
* @param array JSON数组
|
|
260
|
-
* @returns 节点数组
|
|
116
|
+
* 创建指定包名的过滤配置
|
|
117
|
+
* @param targetPackageName 目标包名
|
|
261
118
|
*/
|
|
262
|
-
static
|
|
119
|
+
static createForPackage(targetPackageName: string): AccessibilityEventFilter;
|
|
263
120
|
}
|
|
264
121
|
|
|
265
122
|
/**
|
|
266
|
-
*
|
|
267
|
-
* 表示界面上的一个可交互元素,包含元素的属性和可执行的操作
|
|
123
|
+
* 应用信息实体类
|
|
268
124
|
*/
|
|
269
|
-
|
|
270
|
-
declare class Node {
|
|
271
|
-
/**
|
|
272
|
-
* 节点唯一标识
|
|
273
|
-
*/
|
|
274
|
-
nodeId: string;
|
|
125
|
+
declare class AppInfo {
|
|
275
126
|
/**
|
|
276
|
-
*
|
|
127
|
+
* 是否为系统应用
|
|
277
128
|
*/
|
|
278
|
-
|
|
129
|
+
isSystem: boolean;
|
|
279
130
|
/**
|
|
280
|
-
*
|
|
131
|
+
* 最低SDK版本
|
|
281
132
|
*/
|
|
282
|
-
|
|
133
|
+
minSdkVersion: number;
|
|
283
134
|
/**
|
|
284
|
-
*
|
|
135
|
+
* 应用名称
|
|
285
136
|
*/
|
|
286
|
-
|
|
137
|
+
name: string;
|
|
287
138
|
/**
|
|
288
|
-
*
|
|
139
|
+
* 应用包名
|
|
289
140
|
*/
|
|
290
|
-
|
|
141
|
+
packageName: string;
|
|
291
142
|
/**
|
|
292
|
-
*
|
|
143
|
+
* 目标SDK版本
|
|
293
144
|
*/
|
|
294
|
-
|
|
145
|
+
targetSdkVersion: number;
|
|
295
146
|
/**
|
|
296
|
-
*
|
|
147
|
+
* 版本号
|
|
297
148
|
*/
|
|
298
|
-
|
|
149
|
+
versionCode: number;
|
|
299
150
|
/**
|
|
300
|
-
*
|
|
151
|
+
* 版本名称
|
|
301
152
|
*/
|
|
302
|
-
|
|
153
|
+
versionName: string;
|
|
154
|
+
constructor(isSystem?: boolean, minSdkVersion?: number, name?: string, packageName?: string, targetSdkVersion?: number, versionCode?: number, versionName?: string);
|
|
303
155
|
/**
|
|
304
|
-
*
|
|
156
|
+
* 从JSON对象创建AppInfo实例
|
|
157
|
+
* @param data JSON对象
|
|
158
|
+
* @returns AppInfo实例
|
|
305
159
|
*/
|
|
306
|
-
|
|
160
|
+
static fromJSON(data: any): AppInfo;
|
|
307
161
|
/**
|
|
308
|
-
*
|
|
162
|
+
* 转换为JSON对象
|
|
163
|
+
* @returns JSON对象
|
|
309
164
|
*/
|
|
310
|
-
|
|
165
|
+
toJSON(): any;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* 设备信息实体类
|
|
170
|
+
*/
|
|
171
|
+
declare class DeviceInfo {
|
|
311
172
|
/**
|
|
312
|
-
*
|
|
173
|
+
* 设备唯一标识
|
|
313
174
|
*/
|
|
314
|
-
|
|
175
|
+
uniqueDeviceId: string;
|
|
315
176
|
/**
|
|
316
|
-
*
|
|
177
|
+
* Android ID
|
|
317
178
|
*/
|
|
318
|
-
|
|
179
|
+
androidID: string;
|
|
319
180
|
/**
|
|
320
|
-
*
|
|
181
|
+
* MAC地址
|
|
321
182
|
*/
|
|
322
|
-
|
|
183
|
+
macAddress: string;
|
|
323
184
|
/**
|
|
324
|
-
*
|
|
185
|
+
* 是否已Root
|
|
325
186
|
*/
|
|
326
|
-
|
|
187
|
+
isDeviceRooted: boolean;
|
|
327
188
|
/**
|
|
328
|
-
*
|
|
189
|
+
* 制造商
|
|
329
190
|
*/
|
|
330
|
-
|
|
191
|
+
manufacturer: string;
|
|
331
192
|
/**
|
|
332
|
-
*
|
|
193
|
+
* 设备型号
|
|
333
194
|
*/
|
|
334
|
-
|
|
195
|
+
model: string;
|
|
335
196
|
/**
|
|
336
|
-
*
|
|
197
|
+
* SDK版本号
|
|
337
198
|
*/
|
|
338
|
-
|
|
199
|
+
sdkVersionCode: number;
|
|
339
200
|
/**
|
|
340
|
-
*
|
|
201
|
+
* SDK版本名称
|
|
341
202
|
*/
|
|
342
|
-
|
|
203
|
+
sdkVersionName: string;
|
|
343
204
|
/**
|
|
344
|
-
*
|
|
205
|
+
* ABI列表
|
|
345
206
|
*/
|
|
346
|
-
|
|
207
|
+
abiList: string[];
|
|
347
208
|
/**
|
|
348
|
-
*
|
|
209
|
+
* 是否启用ADB调试
|
|
349
210
|
*/
|
|
350
|
-
|
|
211
|
+
isAdbEnabled: boolean;
|
|
351
212
|
/**
|
|
352
|
-
*
|
|
353
|
-
* @deprecated 请使用 bounds 字段替代
|
|
213
|
+
* 是否启用开发者选项
|
|
354
214
|
*/
|
|
355
|
-
|
|
215
|
+
isDevelopmentSettingsEnabled: boolean;
|
|
356
216
|
/**
|
|
357
|
-
*
|
|
358
|
-
* @param params 节点参数对象
|
|
217
|
+
* 是否为模拟器
|
|
359
218
|
*/
|
|
360
|
-
|
|
361
|
-
nodeId: string;
|
|
362
|
-
text: string;
|
|
363
|
-
des: string;
|
|
364
|
-
viewId: string;
|
|
365
|
-
className: string;
|
|
366
|
-
isScrollable: boolean;
|
|
367
|
-
isClickable: boolean;
|
|
368
|
-
isEnabled: boolean;
|
|
369
|
-
stepId: string | undefined;
|
|
370
|
-
hintText: string;
|
|
371
|
-
isCheckable: boolean;
|
|
372
|
-
isChecked: boolean;
|
|
373
|
-
isFocusable: boolean;
|
|
374
|
-
isFocused: boolean;
|
|
375
|
-
isLongClickable: boolean;
|
|
376
|
-
isPassword: boolean;
|
|
377
|
-
isSelected: boolean;
|
|
378
|
-
isVisibleToUser: boolean;
|
|
379
|
-
drawingOrder: number;
|
|
380
|
-
/** @deprecated 请使用 bounds 替代 */
|
|
381
|
-
boundsInScreen?: Bounds | any;
|
|
382
|
-
bounds?: Bounds | any;
|
|
383
|
-
});
|
|
384
|
-
get async(): NodeAsync;
|
|
219
|
+
isEmulator: boolean;
|
|
385
220
|
/**
|
|
386
|
-
*
|
|
387
|
-
* @param className 类名
|
|
388
|
-
* @returns 父节点
|
|
221
|
+
* 是否为平板
|
|
389
222
|
*/
|
|
390
|
-
|
|
223
|
+
isTablet: boolean;
|
|
224
|
+
constructor(uniqueDeviceId?: string, androidID?: string, macAddress?: string, isDeviceRooted?: boolean, manufacturer?: string, model?: string, sdkVersionCode?: number, sdkVersionName?: string, abiList?: string[], isAdbEnabled?: boolean, isDevelopmentSettingsEnabled?: boolean, isEmulator?: boolean, isTablet?: boolean);
|
|
391
225
|
/**
|
|
392
|
-
*
|
|
393
|
-
* @param
|
|
394
|
-
* @
|
|
395
|
-
* @param switchWindowIntervalDelay 窗口切换延迟
|
|
396
|
-
* @param clickDuration 点击持续时间
|
|
397
|
-
* @returns 是否点击成功
|
|
226
|
+
* 从JSON对象创建DeviceInfo实例
|
|
227
|
+
* @param data JSON对象
|
|
228
|
+
* @returns DeviceInfo实例
|
|
398
229
|
*/
|
|
399
|
-
|
|
400
|
-
offsetX?: number;
|
|
401
|
-
offsetY?: number;
|
|
402
|
-
switchWindowIntervalDelay?: number;
|
|
403
|
-
clickDuration?: number;
|
|
404
|
-
}): Promise<boolean>;
|
|
230
|
+
static fromJSON(data: any): DeviceInfo;
|
|
405
231
|
/**
|
|
406
|
-
*
|
|
407
|
-
* @
|
|
408
|
-
* @param offsetY Y轴偏移
|
|
409
|
-
* @param switchWindowIntervalDelay 窗口切换延迟
|
|
410
|
-
* @param clickDuration 点击持续时间
|
|
411
|
-
* @param clickInterval 点击间隔
|
|
412
|
-
* @returns 是否双击成功
|
|
232
|
+
* 转换为JSON对象
|
|
233
|
+
* @returns JSON对象
|
|
413
234
|
*/
|
|
414
|
-
|
|
415
|
-
offsetX?: number;
|
|
416
|
-
offsetY?: number;
|
|
417
|
-
switchWindowIntervalDelay?: number;
|
|
418
|
-
clickDuration?: number;
|
|
419
|
-
clickInterval?: number;
|
|
420
|
-
}): Promise<boolean>;
|
|
421
|
-
longPressNodeByGestureAutoPaste(text: string, { matchedPackageName, matchedText, timeoutMillis, longPressDuration, }?: {
|
|
422
|
-
matchedPackageName?: string;
|
|
423
|
-
matchedText?: string;
|
|
424
|
-
timeoutMillis?: number;
|
|
425
|
-
longPressDuration?: number;
|
|
426
|
-
}): Promise<boolean>;
|
|
427
|
-
/**
|
|
428
|
-
* 在当前节点范围内通过标签查找节点
|
|
429
|
-
* @param className 类名
|
|
430
|
-
* @param filterText 文本过滤
|
|
431
|
-
* @param filterViewId 视图ID过滤
|
|
432
|
-
* @param filterDes 描述过滤
|
|
433
|
-
* @returns 节点数组
|
|
434
|
-
*/
|
|
435
|
-
findByTags(className: string, { filterText, filterViewId, filterDes, }?: {
|
|
436
|
-
filterText?: string;
|
|
437
|
-
filterViewId?: string;
|
|
438
|
-
filterDes?: string;
|
|
439
|
-
}): Node[];
|
|
440
|
-
/**
|
|
441
|
-
* 在当前节点范围内通过ID查找节点
|
|
442
|
-
* @param id 节点ID
|
|
443
|
-
* @param filterClass 类名过滤
|
|
444
|
-
* @param filterText 文本过滤
|
|
445
|
-
* @param filterDes 描述过滤
|
|
446
|
-
* @returns 节点数组
|
|
447
|
-
*/
|
|
448
|
-
findById(id: string, { filterClass, filterText, filterDes, }?: {
|
|
449
|
-
filterClass?: string;
|
|
450
|
-
filterText?: string;
|
|
451
|
-
filterDes?: string;
|
|
452
|
-
}): Node[];
|
|
453
|
-
/**
|
|
454
|
-
* 在当前节点范围内通过文本查找节点
|
|
455
|
-
* @param text 要查找的文本
|
|
456
|
-
* @param filterClass 类名过滤
|
|
457
|
-
* @param filterViewId 视图ID过滤
|
|
458
|
-
* @param filterDes 描述过滤
|
|
459
|
-
* @returns 节点数组
|
|
460
|
-
*/
|
|
461
|
-
findByText(text: string, { filterClass, filterViewId, filterDes, }?: {
|
|
462
|
-
filterClass?: string;
|
|
463
|
-
filterViewId?: string;
|
|
464
|
-
filterDes?: string;
|
|
465
|
-
}): Node[];
|
|
466
|
-
/**
|
|
467
|
-
* 向前滚动节点
|
|
468
|
-
* @returns 是否滚动成功
|
|
469
|
-
*/
|
|
470
|
-
scrollForward(): boolean;
|
|
471
|
-
/**
|
|
472
|
-
* 向后滚动节点
|
|
473
|
-
* @returns 是否滚动成功
|
|
474
|
-
*/
|
|
475
|
-
scrollBackward(): boolean;
|
|
476
|
-
/**
|
|
477
|
-
* 检查节点是否可见
|
|
478
|
-
* @param compareNode 比较节点
|
|
479
|
-
* @param isFullyByCompareNode 是否完全可见
|
|
480
|
-
* @returns 是否可见
|
|
481
|
-
*/
|
|
482
|
-
isVisible({ compareNode, isFullyByCompareNode, }?: {
|
|
483
|
-
compareNode?: Node;
|
|
484
|
-
isFullyByCompareNode?: boolean;
|
|
485
|
-
}): boolean;
|
|
486
|
-
/**
|
|
487
|
-
* 对节点进行截图
|
|
488
|
-
* @param overlayHiddenScreenshotDelayMillis 截图延迟时间(毫秒)
|
|
489
|
-
* @returns 截图路径
|
|
490
|
-
*/
|
|
491
|
-
takeScreenshot(overlayHiddenScreenshotDelayMillis?: number): Promise<string>;
|
|
492
|
-
/**
|
|
493
|
-
* 保存节点截图到文件
|
|
494
|
-
* @param options 截图保存选项
|
|
495
|
-
* @param options.filePath 文件路径(可选,不提供则自动生成)
|
|
496
|
-
* @param options.format 图片格式,支持 "PNG"、"JPEG"、"JPG"、"WEBP",默认为 "PNG"
|
|
497
|
-
* @param options.overlayHiddenScreenshotDelayMillis 截图延迟时间(毫秒),默认为 250
|
|
498
|
-
* @returns 保存的文件路径
|
|
499
|
-
*/
|
|
500
|
-
takeScreenshotToFile(options?: {
|
|
501
|
-
filePath?: string;
|
|
502
|
-
format?: "PNG" | "JPEG" | "JPG" | "WEBP";
|
|
503
|
-
overlayHiddenScreenshotDelayMillis?: number;
|
|
504
|
-
}): Promise<string>;
|
|
505
|
-
/**
|
|
506
|
-
* 设置节点文本
|
|
507
|
-
* @param text 要设置的文本
|
|
508
|
-
* @returns 是否设置成功
|
|
509
|
-
*/
|
|
510
|
-
setNodeText(text: string): boolean;
|
|
511
|
-
paste(text: string): boolean;
|
|
512
|
-
focus(): boolean;
|
|
513
|
-
/**
|
|
514
|
-
* 点击节点
|
|
515
|
-
* @returns 是否点击成功
|
|
516
|
-
*/
|
|
517
|
-
click(): boolean;
|
|
518
|
-
/**
|
|
519
|
-
* 长按节点
|
|
520
|
-
* @returns 是否长按成功
|
|
521
|
-
*/
|
|
522
|
-
longClick(): boolean;
|
|
523
|
-
/**
|
|
524
|
-
* 查找第一个可点击的父节点
|
|
525
|
-
* @returns 可点击的父节点
|
|
526
|
-
*/
|
|
527
|
-
findFirstParentClickable(): Node;
|
|
528
|
-
/**
|
|
529
|
-
* 获取节点在屏幕中的边界
|
|
530
|
-
* @returns 边界对象
|
|
531
|
-
*/
|
|
532
|
-
getBoundsInScreen(): Bounds;
|
|
533
|
-
/**
|
|
534
|
-
* 获取节点的所有子节点
|
|
535
|
-
* @returns 子节点数组
|
|
536
|
-
*/
|
|
537
|
-
getNodes(): Node[];
|
|
538
|
-
/**
|
|
539
|
-
* 获取节点的直接子节点
|
|
540
|
-
* @returns 子节点数组
|
|
541
|
-
*/
|
|
542
|
-
getChildren(): Node[];
|
|
543
|
-
/**
|
|
544
|
-
* 从JSON字符串创建节点实例
|
|
545
|
-
* @param json JSON字符串
|
|
546
|
-
* @returns 节点实例
|
|
547
|
-
*/
|
|
548
|
-
static fromJSON(json: string): Node;
|
|
549
|
-
/**
|
|
550
|
-
* 从普通对象创建节点实例
|
|
551
|
-
* @param data 对象数据
|
|
552
|
-
* @returns 节点实例
|
|
553
|
-
*/
|
|
554
|
-
static from(data: any): Node;
|
|
555
|
-
/**
|
|
556
|
-
* JSON.parse的reviver函数,用于将解析的JSON对象转换为Node实例
|
|
557
|
-
* @param key 属性键
|
|
558
|
-
* @param value 属性值
|
|
559
|
-
* @returns 转换后的值
|
|
560
|
-
*/
|
|
561
|
-
static reviver(key: string, value: any): any;
|
|
562
|
-
/**
|
|
563
|
-
* 创建新的节点实例
|
|
564
|
-
* @param params 节点参数对象
|
|
565
|
-
* @returns 节点实例
|
|
566
|
-
*/
|
|
567
|
-
static create(params: {
|
|
568
|
-
nodeId: string;
|
|
569
|
-
text: string;
|
|
570
|
-
des: string;
|
|
571
|
-
viewId: string;
|
|
572
|
-
className: string;
|
|
573
|
-
isScrollable: boolean;
|
|
574
|
-
isClickable: boolean;
|
|
575
|
-
isEnabled: boolean;
|
|
576
|
-
stepId: string | undefined;
|
|
577
|
-
hintText: string;
|
|
578
|
-
isCheckable: boolean;
|
|
579
|
-
isChecked: boolean;
|
|
580
|
-
isFocusable: boolean;
|
|
581
|
-
isFocused: boolean;
|
|
582
|
-
isLongClickable: boolean;
|
|
583
|
-
isPassword: boolean;
|
|
584
|
-
isSelected: boolean;
|
|
585
|
-
isVisibleToUser: boolean;
|
|
586
|
-
drawingOrder: number;
|
|
587
|
-
bounds?: Bounds;
|
|
588
|
-
/** @deprecated 请使用 bounds 替代 */
|
|
589
|
-
boundsInScreen?: Bounds;
|
|
590
|
-
}): Node;
|
|
591
|
-
/**
|
|
592
|
-
* 从JSON数组创建节点数组
|
|
593
|
-
* @param array JSON数组
|
|
594
|
-
* @returns 节点数组
|
|
595
|
-
*/
|
|
596
|
-
static fromJSONArray(array: Array<any>): Node[];
|
|
235
|
+
toJSON(): any;
|
|
597
236
|
}
|
|
598
237
|
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
constructor(code: number, data: any | null, callbackId: string | null);
|
|
604
|
-
isSuccess(): boolean;
|
|
605
|
-
getData(): any | null;
|
|
606
|
-
getDataOrNull(): any | null;
|
|
607
|
-
getDataOrDefault(defaultValue: any): any;
|
|
608
|
-
}
|
|
238
|
+
/**
|
|
239
|
+
* AssistsX 类
|
|
240
|
+
* 提供与移动应用程序界面交互的工具类,包括节点查找、手势操作、屏幕操作等功能
|
|
241
|
+
*/
|
|
609
242
|
|
|
610
243
|
/**
|
|
611
|
-
*
|
|
612
|
-
* 用于配置AccessibilityEvent的处理方式和过滤条件
|
|
244
|
+
* 无障碍事件数据结构
|
|
613
245
|
*/
|
|
614
|
-
interface
|
|
246
|
+
interface AccessibilityEventData {
|
|
247
|
+
packageName: string;
|
|
248
|
+
className: string;
|
|
249
|
+
eventType: number;
|
|
250
|
+
action: number;
|
|
251
|
+
texts: string[];
|
|
252
|
+
node: Node | null;
|
|
253
|
+
}
|
|
254
|
+
/**
|
|
255
|
+
* 无障碍事件完整结构
|
|
256
|
+
*/
|
|
257
|
+
interface AccessibilityEvent {
|
|
258
|
+
callbackId: string;
|
|
259
|
+
code: number;
|
|
260
|
+
data: AccessibilityEventData;
|
|
261
|
+
message: string;
|
|
262
|
+
}
|
|
263
|
+
/**
|
|
264
|
+
* 无障碍事件监听器类型
|
|
265
|
+
*/
|
|
266
|
+
type AccessibilityEventListener = (event: AccessibilityEvent) => void;
|
|
267
|
+
/**
|
|
268
|
+
* Web浮动窗口选项接口定义
|
|
269
|
+
*/
|
|
270
|
+
interface WebFloatingWindowOptions {
|
|
271
|
+
initialWidth?: number;
|
|
272
|
+
initialHeight?: number;
|
|
273
|
+
/** Initial window X position (default 0) */
|
|
274
|
+
initialX?: number;
|
|
275
|
+
/** Initial window Y position (default 0) */
|
|
276
|
+
initialY?: number;
|
|
277
|
+
minWidth?: number;
|
|
278
|
+
minHeight?: number;
|
|
279
|
+
maxWidth?: number;
|
|
280
|
+
maxHeight?: number;
|
|
281
|
+
initialCenter?: boolean;
|
|
282
|
+
/** Whether to show top operation area (title bar, close button, etc.) */
|
|
283
|
+
showTopOperationArea?: boolean;
|
|
284
|
+
/** Whether to show bottom operation area (zoom, back/forward/refresh, etc.) */
|
|
285
|
+
showBottomOperationArea?: boolean;
|
|
286
|
+
/** Background color: hex string (e.g. "#ffffff") or Android color int */
|
|
287
|
+
backgroundColor?: string | number;
|
|
288
|
+
}
|
|
289
|
+
declare const callbacks: Map<string, (data: string) => void>;
|
|
290
|
+
declare const accessibilityEventListeners: AccessibilityEventListener[];
|
|
291
|
+
/**
|
|
292
|
+
* 屏幕尺寸类型(width/height 为整型像素值)
|
|
293
|
+
*/
|
|
294
|
+
interface Screen {
|
|
295
|
+
width: number;
|
|
296
|
+
height: number;
|
|
297
|
+
}
|
|
298
|
+
/** 全局屏幕尺寸,在 assistsxCallback 初始化后自动加载 */
|
|
299
|
+
declare let screen: Screen;
|
|
300
|
+
declare class AssistsX {
|
|
615
301
|
/**
|
|
616
|
-
*
|
|
617
|
-
*
|
|
618
|
-
* 如果指定包名,则只处理该包的事件
|
|
302
|
+
* 屏幕尺寸(与全局变量 screen 同源)
|
|
303
|
+
* @deprecated 已过时,请使用全局变量 {@link screen}
|
|
619
304
|
*/
|
|
620
|
-
|
|
305
|
+
static get screenSize(): any;
|
|
621
306
|
/**
|
|
622
|
-
*
|
|
623
|
-
*
|
|
624
|
-
*
|
|
307
|
+
* 执行同步调用
|
|
308
|
+
* @param method 方法名
|
|
309
|
+
* @param args 参数对象
|
|
310
|
+
* @returns 调用响应
|
|
625
311
|
*/
|
|
626
|
-
|
|
312
|
+
static call(method: string, { args, node }?: {
|
|
313
|
+
args?: any;
|
|
314
|
+
node?: Node;
|
|
315
|
+
}): CallResponse;
|
|
627
316
|
/**
|
|
628
|
-
*
|
|
629
|
-
*
|
|
630
|
-
*
|
|
317
|
+
* 执行异步调用
|
|
318
|
+
* @param method 方法名
|
|
319
|
+
* @param args 参数对象
|
|
320
|
+
* @param timeout 超时时间(秒),默认30秒
|
|
321
|
+
* @returns Promise<调用响应>
|
|
631
322
|
*/
|
|
632
|
-
|
|
323
|
+
static asyncCall(method: string, { args, node, nodes, timeout, }?: {
|
|
324
|
+
args?: any;
|
|
325
|
+
node?: Node;
|
|
326
|
+
nodes?: Node[];
|
|
327
|
+
timeout?: number;
|
|
328
|
+
}): Promise<CallResponse>;
|
|
633
329
|
/**
|
|
634
|
-
*
|
|
635
|
-
*
|
|
636
|
-
*
|
|
330
|
+
* 设置悬浮窗标志
|
|
331
|
+
* @param flags 标志
|
|
332
|
+
* @returns 是否设置成功
|
|
637
333
|
*/
|
|
638
|
-
|
|
334
|
+
static setOverlayFlags(flags: number): boolean;
|
|
639
335
|
/**
|
|
640
|
-
*
|
|
641
|
-
*
|
|
642
|
-
*
|
|
336
|
+
* 设置悬浮窗标志
|
|
337
|
+
* @param flags 标志
|
|
338
|
+
* @returns 是否设置成功
|
|
643
339
|
*/
|
|
644
|
-
|
|
340
|
+
static setOverlayFlagList(flags: number[]): boolean;
|
|
645
341
|
/**
|
|
646
|
-
*
|
|
647
|
-
*
|
|
648
|
-
*
|
|
342
|
+
* 获取所有符合条件的节点
|
|
343
|
+
* @param filterClass 类名过滤
|
|
344
|
+
* @param filterViewId 视图ID过滤
|
|
345
|
+
* @param filterDes 描述过滤
|
|
346
|
+
* @param filterText 文本过滤
|
|
347
|
+
* @returns 节点数组
|
|
649
348
|
*/
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
349
|
+
static getAllNodes({ filterClass, filterViewId, filterDes, filterText, scope, }?: {
|
|
350
|
+
filterClass?: string;
|
|
351
|
+
filterViewId?: string;
|
|
352
|
+
filterDes?: string;
|
|
353
|
+
filterText?: string;
|
|
354
|
+
scope?: NodeLookupScope;
|
|
355
|
+
}): Node[];
|
|
657
356
|
/**
|
|
658
|
-
*
|
|
357
|
+
* 设置节点文本
|
|
358
|
+
* @param node 目标节点
|
|
359
|
+
* @param text 要设置的文本
|
|
360
|
+
* @returns 是否设置成功
|
|
659
361
|
*/
|
|
660
|
-
|
|
362
|
+
static setNodeText(node: Node, text: string): boolean;
|
|
661
363
|
/**
|
|
662
|
-
*
|
|
364
|
+
* 获取剪贴板最新文本
|
|
365
|
+
* @returns 剪贴板最新文本
|
|
663
366
|
*/
|
|
664
|
-
|
|
367
|
+
static getClipboardLatestText(): any;
|
|
665
368
|
/**
|
|
666
|
-
*
|
|
369
|
+
* 获取剪贴板文本内容(异步)
|
|
370
|
+
* @param timeout 超时时间(秒),默认30秒
|
|
371
|
+
* @returns 剪贴板文本内容,如果获取失败则返回空字符串
|
|
667
372
|
*/
|
|
668
|
-
|
|
373
|
+
static getClipboardText(timeout?: number): Promise<string>;
|
|
669
374
|
/**
|
|
670
|
-
*
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
/**
|
|
674
|
-
* 事件类型过滤
|
|
675
|
-
*/
|
|
676
|
-
readonly eventTypes?: number[] | null;
|
|
677
|
-
/**
|
|
678
|
-
* 是否启用事件去重
|
|
679
|
-
*/
|
|
680
|
-
readonly enableDeduplication: boolean;
|
|
681
|
-
constructor(config?: AccessibilityEventFilterConfig);
|
|
682
|
-
/**
|
|
683
|
-
* 检查是否应该处理指定包的事件
|
|
684
|
-
* @param targetPackageName 目标包名
|
|
685
|
-
* @returns true表示应该处理,false表示应该过滤
|
|
686
|
-
*/
|
|
687
|
-
shouldProcessPackage(targetPackageName: string | null): boolean;
|
|
688
|
-
/**
|
|
689
|
-
* 检查是否应该处理指定类型的事件
|
|
690
|
-
* @param eventType 事件类型
|
|
691
|
-
* @returns true表示应该处理,false表示应该过滤
|
|
692
|
-
*/
|
|
693
|
-
shouldProcessEventType(eventType: number): boolean;
|
|
694
|
-
/**
|
|
695
|
-
* 创建默认的过滤配置
|
|
696
|
-
* 所有包名,子线程处理,获取节点信息,启用日志
|
|
697
|
-
*/
|
|
698
|
-
static createDefault(): AccessibilityEventFilter;
|
|
699
|
-
/**
|
|
700
|
-
* 创建高性能配置
|
|
701
|
-
* 不获取节点信息,不启用日志,启用去重
|
|
702
|
-
*/
|
|
703
|
-
static createHighPerformance(): AccessibilityEventFilter;
|
|
704
|
-
/**
|
|
705
|
-
* 创建调试配置
|
|
706
|
-
* 启用所有功能,便于调试
|
|
707
|
-
*/
|
|
708
|
-
static createDebug(): AccessibilityEventFilter;
|
|
709
|
-
/**
|
|
710
|
-
* 创建指定包名的过滤配置
|
|
711
|
-
* @param targetPackageName 目标包名
|
|
712
|
-
*/
|
|
713
|
-
static createForPackage(targetPackageName: string): AccessibilityEventFilter;
|
|
714
|
-
}
|
|
715
|
-
|
|
716
|
-
/**
|
|
717
|
-
* 应用信息实体类
|
|
718
|
-
*/
|
|
719
|
-
declare class AppInfo {
|
|
720
|
-
/**
|
|
721
|
-
* 是否为系统应用
|
|
722
|
-
*/
|
|
723
|
-
isSystem: boolean;
|
|
724
|
-
/**
|
|
725
|
-
* 最低SDK版本
|
|
726
|
-
*/
|
|
727
|
-
minSdkVersion: number;
|
|
728
|
-
/**
|
|
729
|
-
* 应用名称
|
|
730
|
-
*/
|
|
731
|
-
name: string;
|
|
732
|
-
/**
|
|
733
|
-
* 应用包名
|
|
734
|
-
*/
|
|
735
|
-
packageName: string;
|
|
736
|
-
/**
|
|
737
|
-
* 目标SDK版本
|
|
738
|
-
*/
|
|
739
|
-
targetSdkVersion: number;
|
|
740
|
-
/**
|
|
741
|
-
* 版本号
|
|
742
|
-
*/
|
|
743
|
-
versionCode: number;
|
|
744
|
-
/**
|
|
745
|
-
* 版本名称
|
|
746
|
-
*/
|
|
747
|
-
versionName: string;
|
|
748
|
-
constructor(isSystem?: boolean, minSdkVersion?: number, name?: string, packageName?: string, targetSdkVersion?: number, versionCode?: number, versionName?: string);
|
|
749
|
-
/**
|
|
750
|
-
* 从JSON对象创建AppInfo实例
|
|
751
|
-
* @param data JSON对象
|
|
752
|
-
* @returns AppInfo实例
|
|
753
|
-
*/
|
|
754
|
-
static fromJSON(data: any): AppInfo;
|
|
755
|
-
/**
|
|
756
|
-
* 转换为JSON对象
|
|
757
|
-
* @returns JSON对象
|
|
758
|
-
*/
|
|
759
|
-
toJSON(): any;
|
|
760
|
-
}
|
|
761
|
-
|
|
762
|
-
/**
|
|
763
|
-
* 设备信息实体类
|
|
764
|
-
*/
|
|
765
|
-
declare class DeviceInfo {
|
|
766
|
-
/**
|
|
767
|
-
* 设备唯一标识
|
|
768
|
-
*/
|
|
769
|
-
uniqueDeviceId: string;
|
|
770
|
-
/**
|
|
771
|
-
* Android ID
|
|
772
|
-
*/
|
|
773
|
-
androidID: string;
|
|
774
|
-
/**
|
|
775
|
-
* MAC地址
|
|
776
|
-
*/
|
|
777
|
-
macAddress: string;
|
|
778
|
-
/**
|
|
779
|
-
* 是否已Root
|
|
780
|
-
*/
|
|
781
|
-
isDeviceRooted: boolean;
|
|
782
|
-
/**
|
|
783
|
-
* 制造商
|
|
784
|
-
*/
|
|
785
|
-
manufacturer: string;
|
|
786
|
-
/**
|
|
787
|
-
* 设备型号
|
|
788
|
-
*/
|
|
789
|
-
model: string;
|
|
790
|
-
/**
|
|
791
|
-
* SDK版本号
|
|
792
|
-
*/
|
|
793
|
-
sdkVersionCode: number;
|
|
794
|
-
/**
|
|
795
|
-
* SDK版本名称
|
|
796
|
-
*/
|
|
797
|
-
sdkVersionName: string;
|
|
798
|
-
/**
|
|
799
|
-
* ABI列表
|
|
800
|
-
*/
|
|
801
|
-
abiList: string[];
|
|
802
|
-
/**
|
|
803
|
-
* 是否启用ADB调试
|
|
804
|
-
*/
|
|
805
|
-
isAdbEnabled: boolean;
|
|
806
|
-
/**
|
|
807
|
-
* 是否启用开发者选项
|
|
808
|
-
*/
|
|
809
|
-
isDevelopmentSettingsEnabled: boolean;
|
|
810
|
-
/**
|
|
811
|
-
* 是否为模拟器
|
|
812
|
-
*/
|
|
813
|
-
isEmulator: boolean;
|
|
814
|
-
/**
|
|
815
|
-
* 是否为平板
|
|
816
|
-
*/
|
|
817
|
-
isTablet: boolean;
|
|
818
|
-
constructor(uniqueDeviceId?: string, androidID?: string, macAddress?: string, isDeviceRooted?: boolean, manufacturer?: string, model?: string, sdkVersionCode?: number, sdkVersionName?: string, abiList?: string[], isAdbEnabled?: boolean, isDevelopmentSettingsEnabled?: boolean, isEmulator?: boolean, isTablet?: boolean);
|
|
819
|
-
/**
|
|
820
|
-
* 从JSON对象创建DeviceInfo实例
|
|
821
|
-
* @param data JSON对象
|
|
822
|
-
* @returns DeviceInfo实例
|
|
823
|
-
*/
|
|
824
|
-
static fromJSON(data: any): DeviceInfo;
|
|
825
|
-
/**
|
|
826
|
-
* 转换为JSON对象
|
|
827
|
-
* @returns JSON对象
|
|
828
|
-
*/
|
|
829
|
-
toJSON(): any;
|
|
830
|
-
}
|
|
831
|
-
|
|
832
|
-
/**
|
|
833
|
-
* AssistsX 类
|
|
834
|
-
* 提供与移动应用程序界面交互的工具类,包括节点查找、手势操作、屏幕操作等功能
|
|
835
|
-
*/
|
|
836
|
-
|
|
837
|
-
/**
|
|
838
|
-
* 无障碍事件数据结构
|
|
839
|
-
*/
|
|
840
|
-
interface AccessibilityEventData {
|
|
841
|
-
packageName: string;
|
|
842
|
-
className: string;
|
|
843
|
-
eventType: number;
|
|
844
|
-
action: number;
|
|
845
|
-
texts: string[];
|
|
846
|
-
node: Node | null;
|
|
847
|
-
}
|
|
848
|
-
/**
|
|
849
|
-
* 无障碍事件完整结构
|
|
850
|
-
*/
|
|
851
|
-
interface AccessibilityEvent {
|
|
852
|
-
callbackId: string;
|
|
853
|
-
code: number;
|
|
854
|
-
data: AccessibilityEventData;
|
|
855
|
-
message: string;
|
|
856
|
-
}
|
|
857
|
-
/**
|
|
858
|
-
* 无障碍事件监听器类型
|
|
859
|
-
*/
|
|
860
|
-
type AccessibilityEventListener = (event: AccessibilityEvent) => void;
|
|
861
|
-
/**
|
|
862
|
-
* Web浮动窗口选项接口定义
|
|
863
|
-
*/
|
|
864
|
-
interface WebFloatingWindowOptions {
|
|
865
|
-
initialWidth?: number;
|
|
866
|
-
initialHeight?: number;
|
|
867
|
-
/** Initial window X position (default 0) */
|
|
868
|
-
initialX?: number;
|
|
869
|
-
/** Initial window Y position (default 0) */
|
|
870
|
-
initialY?: number;
|
|
871
|
-
minWidth?: number;
|
|
872
|
-
minHeight?: number;
|
|
873
|
-
maxWidth?: number;
|
|
874
|
-
maxHeight?: number;
|
|
875
|
-
initialCenter?: boolean;
|
|
876
|
-
/** Whether to show top operation area (title bar, close button, etc.) */
|
|
877
|
-
showTopOperationArea?: boolean;
|
|
878
|
-
/** Whether to show bottom operation area (zoom, back/forward/refresh, etc.) */
|
|
879
|
-
showBottomOperationArea?: boolean;
|
|
880
|
-
/** Background color: hex string (e.g. "#ffffff") or Android color int */
|
|
881
|
-
backgroundColor?: string | number;
|
|
882
|
-
}
|
|
883
|
-
declare const callbacks: Map<string, (data: string) => void>;
|
|
884
|
-
declare const accessibilityEventListeners: AccessibilityEventListener[];
|
|
885
|
-
/**
|
|
886
|
-
* 屏幕尺寸类型(width/height 为整型像素值)
|
|
887
|
-
*/
|
|
888
|
-
interface Screen {
|
|
889
|
-
width: number;
|
|
890
|
-
height: number;
|
|
891
|
-
}
|
|
892
|
-
/** 全局屏幕尺寸,在 assistsxCallback 初始化后自动加载 */
|
|
893
|
-
declare let screen: Screen | null;
|
|
894
|
-
declare class AssistsX {
|
|
895
|
-
/**
|
|
896
|
-
* 屏幕尺寸(与全局变量 screen 同源)
|
|
897
|
-
* @deprecated 已过时,请使用全局变量 {@link screen}
|
|
898
|
-
*/
|
|
899
|
-
static get screenSize(): any;
|
|
900
|
-
/**
|
|
901
|
-
* 执行同步调用
|
|
902
|
-
* @param method 方法名
|
|
903
|
-
* @param args 参数对象
|
|
904
|
-
* @returns 调用响应
|
|
905
|
-
*/
|
|
906
|
-
static call(method: string, { args, node }?: {
|
|
907
|
-
args?: any;
|
|
908
|
-
node?: Node;
|
|
909
|
-
}): CallResponse;
|
|
910
|
-
/**
|
|
911
|
-
* 执行异步调用
|
|
912
|
-
* @param method 方法名
|
|
913
|
-
* @param args 参数对象
|
|
914
|
-
* @param timeout 超时时间(秒),默认30秒
|
|
915
|
-
* @returns Promise<调用响应>
|
|
916
|
-
*/
|
|
917
|
-
static asyncCall(method: string, { args, node, nodes, timeout, }?: {
|
|
918
|
-
args?: any;
|
|
919
|
-
node?: Node;
|
|
920
|
-
nodes?: Node[];
|
|
921
|
-
timeout?: number;
|
|
922
|
-
}): Promise<CallResponse>;
|
|
923
|
-
/**
|
|
924
|
-
* 设置悬浮窗标志
|
|
925
|
-
* @param flags 标志
|
|
926
|
-
* @returns 是否设置成功
|
|
927
|
-
*/
|
|
928
|
-
static setOverlayFlags(flags: number): boolean;
|
|
929
|
-
/**
|
|
930
|
-
* 设置悬浮窗标志
|
|
931
|
-
* @param flags 标志
|
|
932
|
-
* @returns 是否设置成功
|
|
933
|
-
*/
|
|
934
|
-
static setOverlayFlagList(flags: number[]): boolean;
|
|
935
|
-
/**
|
|
936
|
-
* 获取所有符合条件的节点
|
|
937
|
-
* @param filterClass 类名过滤
|
|
938
|
-
* @param filterViewId 视图ID过滤
|
|
939
|
-
* @param filterDes 描述过滤
|
|
940
|
-
* @param filterText 文本过滤
|
|
941
|
-
* @returns 节点数组
|
|
942
|
-
*/
|
|
943
|
-
static getAllNodes({ filterClass, filterViewId, filterDes, filterText, }?: {
|
|
944
|
-
filterClass?: string;
|
|
945
|
-
filterViewId?: string;
|
|
946
|
-
filterDes?: string;
|
|
947
|
-
filterText?: string;
|
|
948
|
-
}): Node[];
|
|
949
|
-
/**
|
|
950
|
-
* 设置节点文本
|
|
951
|
-
* @param node 目标节点
|
|
952
|
-
* @param text 要设置的文本
|
|
953
|
-
* @returns 是否设置成功
|
|
954
|
-
*/
|
|
955
|
-
static setNodeText(node: Node, text: string): boolean;
|
|
956
|
-
/**
|
|
957
|
-
* 获取剪贴板最新文本
|
|
958
|
-
* @returns 剪贴板最新文本
|
|
959
|
-
*/
|
|
960
|
-
static getClipboardLatestText(): any;
|
|
961
|
-
/**
|
|
962
|
-
* 获取剪贴板文本内容(异步)
|
|
963
|
-
* @param timeout 超时时间(秒),默认30秒
|
|
964
|
-
* @returns 剪贴板文本内容,如果获取失败则返回空字符串
|
|
965
|
-
*/
|
|
966
|
-
static getClipboardText(timeout?: number): Promise<string>;
|
|
967
|
-
/**
|
|
968
|
-
* 在浏览器中打开URL
|
|
969
|
-
* @param url 要打开的URL
|
|
970
|
-
* @returns 是否成功打开
|
|
971
|
-
*/
|
|
972
|
-
static openUrlInBrowser(url: string): boolean;
|
|
973
|
-
/**
|
|
974
|
-
* 保持屏幕常亮
|
|
975
|
-
* @param tip 提示文本
|
|
976
|
-
* @returns 是否保持屏幕常亮成功
|
|
977
|
-
*/
|
|
978
|
-
static keepScreenOn(tip?: string): boolean;
|
|
979
|
-
static clearKeepScreenOn(): boolean;
|
|
980
|
-
static isAppInstalled(packageName: string): boolean;
|
|
981
|
-
/**
|
|
982
|
-
* 对指定节点进行截图
|
|
983
|
-
* @param nodes 要截图的节点数组
|
|
984
|
-
* @param overlayHiddenScreenshotDelayMillis 截图延迟时间(毫秒)
|
|
985
|
-
* @param timeout 超时时间(秒),默认30秒
|
|
986
|
-
* @returns 截图路径数组
|
|
987
|
-
*/
|
|
988
|
-
static takeScreenshotNodes(nodes: Node[], overlayHiddenScreenshotDelayMillis?: number, timeout?: number): Promise<string[]>;
|
|
989
|
-
static scanQR(timeout?: number): Promise<string>;
|
|
990
|
-
static loadWebViewOverlay(url: string, options?: WebFloatingWindowOptions & {
|
|
991
|
-
timeout?: number;
|
|
992
|
-
}): Promise<any>;
|
|
993
|
-
/**
|
|
994
|
-
* 点击节点
|
|
995
|
-
* @param node 要点击的节点
|
|
996
|
-
* @returns 是否点击成功
|
|
997
|
-
*/
|
|
998
|
-
static click(node: Node): boolean;
|
|
999
|
-
/**
|
|
1000
|
-
* 长按节点
|
|
1001
|
-
* @param node 要长按的节点
|
|
1002
|
-
* @returns 是否长按成功
|
|
1003
|
-
*/
|
|
1004
|
-
static longClick(node: Node): boolean;
|
|
1005
|
-
/**
|
|
1006
|
-
* 启动应用
|
|
1007
|
-
* @param packageName 应用包名
|
|
1008
|
-
* @returns 是否启动成功
|
|
1009
|
-
*/
|
|
1010
|
-
static launchApp(packageName: string): boolean;
|
|
1011
|
-
/**
|
|
1012
|
-
* 获取当前应用包名
|
|
1013
|
-
* @returns 包名
|
|
1014
|
-
*/
|
|
1015
|
-
static getPackageName(): string;
|
|
1016
|
-
/**
|
|
1017
|
-
* 显示悬浮提示
|
|
1018
|
-
* @param text 提示文本
|
|
1019
|
-
* @param delay 显示时长(毫秒)
|
|
1020
|
-
* @returns 是否显示成功
|
|
1021
|
-
*/
|
|
1022
|
-
static overlayToast(text: string, delay?: number): boolean;
|
|
1023
|
-
/**
|
|
1024
|
-
* 通过ID查找节点
|
|
1025
|
-
* @param id 节点ID
|
|
1026
|
-
* @param filterClass 类名过滤
|
|
1027
|
-
* @param filterText 文本过滤
|
|
1028
|
-
* @param filterDes 描述过滤
|
|
1029
|
-
* @param node 父节点范围
|
|
1030
|
-
* @returns 节点数组
|
|
1031
|
-
*/
|
|
1032
|
-
static findById(id: string, { filterClass, filterText, filterDes, node, }?: {
|
|
1033
|
-
filterClass?: string;
|
|
1034
|
-
filterText?: string;
|
|
1035
|
-
filterDes?: string;
|
|
1036
|
-
node?: Node;
|
|
1037
|
-
}): Node[];
|
|
1038
|
-
/**
|
|
1039
|
-
* 通过文本查找节点
|
|
1040
|
-
* @param text 要查找的文本
|
|
1041
|
-
* @param filterClass 类名过滤
|
|
1042
|
-
* @param filterViewId 视图ID过滤
|
|
1043
|
-
* @param filterDes 描述过滤
|
|
1044
|
-
* @param node 父节点范围
|
|
1045
|
-
* @returns 节点数组
|
|
1046
|
-
*/
|
|
1047
|
-
static findByText(text: string, { filterClass, filterViewId, filterDes, node, }?: {
|
|
1048
|
-
filterClass?: string;
|
|
1049
|
-
filterViewId?: string;
|
|
1050
|
-
filterDes?: string;
|
|
1051
|
-
node?: Node;
|
|
1052
|
-
}): Node[];
|
|
1053
|
-
/**
|
|
1054
|
-
* 通过标签查找节点
|
|
1055
|
-
* @param className 类名
|
|
1056
|
-
* @param filterText 文本过滤
|
|
1057
|
-
* @param filterViewId 视图ID过滤
|
|
1058
|
-
* @param filterDes 描述过滤
|
|
1059
|
-
* @param node 父节点范围
|
|
1060
|
-
* @returns 节点数组
|
|
1061
|
-
*/
|
|
1062
|
-
static findByTags(className: string, { filterText, filterViewId, filterDes, node, }?: {
|
|
1063
|
-
filterText?: string;
|
|
1064
|
-
filterViewId?: string;
|
|
1065
|
-
filterDes?: string;
|
|
1066
|
-
node?: Node;
|
|
1067
|
-
}): Node[];
|
|
1068
|
-
/**
|
|
1069
|
-
* 查找所有匹配文本的节点
|
|
1070
|
-
* @param text 要查找的文本
|
|
1071
|
-
* @returns 节点数组
|
|
1072
|
-
*/
|
|
1073
|
-
static findByTextAllMatch(text: string): Node[];
|
|
1074
|
-
/**
|
|
1075
|
-
* 检查是否包含指定文本
|
|
1076
|
-
* @param text 要检查的文本
|
|
1077
|
-
* @returns 是否包含
|
|
1078
|
-
*/
|
|
1079
|
-
static containsText(text: string): boolean;
|
|
1080
|
-
/**
|
|
1081
|
-
* 获取所有文本
|
|
1082
|
-
* @returns 文本数组
|
|
1083
|
-
*/
|
|
1084
|
-
static getAllText(): string[];
|
|
1085
|
-
/**
|
|
1086
|
-
* 查找第一个匹配标签的父节点
|
|
1087
|
-
* @param className 类名
|
|
1088
|
-
* @returns 父节点
|
|
1089
|
-
*/
|
|
1090
|
-
static findFirstParentByTags(node: Node, className: string): Node;
|
|
1091
|
-
/**
|
|
1092
|
-
* 获取节点的所有子节点
|
|
1093
|
-
* @param node 父节点
|
|
1094
|
-
* @returns 子节点数组
|
|
1095
|
-
*/
|
|
1096
|
-
static getNodes(node: Node): Node[];
|
|
1097
|
-
/**
|
|
1098
|
-
* 获取节点的直接子节点
|
|
1099
|
-
* @param node 父节点
|
|
1100
|
-
* @returns 子节点数组
|
|
1101
|
-
*/
|
|
1102
|
-
static getChildren(node: Node): Node[];
|
|
1103
|
-
/**
|
|
1104
|
-
* 查找第一个可点击的父节点
|
|
1105
|
-
* @param node 起始节点
|
|
1106
|
-
* @returns 可点击的父节点
|
|
1107
|
-
*/
|
|
1108
|
-
static findFirstParentClickable(node: Node): Node;
|
|
1109
|
-
/**
|
|
1110
|
-
* 获取节点在屏幕中的边界
|
|
1111
|
-
* @param node 目标节点
|
|
1112
|
-
* @returns 边界对象
|
|
1113
|
-
*/
|
|
1114
|
-
static getBoundsInScreen(node: Node): Bounds;
|
|
1115
|
-
/**
|
|
1116
|
-
* 检查节点是否可见
|
|
1117
|
-
* @param node 目标节点
|
|
1118
|
-
* @param compareNode 比较节点
|
|
1119
|
-
* @param isFullyByCompareNode 是否完全可见
|
|
1120
|
-
* @returns 是否可见
|
|
1121
|
-
*/
|
|
1122
|
-
static isVisible(node: Node, { compareNode, isFullyByCompareNode, }?: {
|
|
1123
|
-
compareNode?: Node;
|
|
1124
|
-
isFullyByCompareNode?: boolean;
|
|
1125
|
-
}): boolean;
|
|
1126
|
-
/**
|
|
1127
|
-
* 执行点击手势
|
|
1128
|
-
* @param x 横坐标
|
|
1129
|
-
* @param y 纵坐标
|
|
1130
|
-
* @param duration 持续时间
|
|
1131
|
-
* @param timeout 超时时间(秒),默认30秒
|
|
1132
|
-
* @returns 是否成功
|
|
1133
|
-
*/
|
|
1134
|
-
static clickByGesture(x: number, y: number, duration: number, timeout?: number): Promise<boolean>;
|
|
1135
|
-
/**
|
|
1136
|
-
* 返回操作
|
|
1137
|
-
* @returns 是否成功
|
|
1138
|
-
*/
|
|
1139
|
-
static back(): boolean;
|
|
1140
|
-
/**
|
|
1141
|
-
* 回到主页
|
|
1142
|
-
* @returns 是否成功
|
|
1143
|
-
*/
|
|
1144
|
-
static home(): boolean;
|
|
1145
|
-
/**
|
|
1146
|
-
* 打开通知栏
|
|
1147
|
-
* @returns 是否成功
|
|
1148
|
-
*/
|
|
1149
|
-
static notifications(): boolean;
|
|
1150
|
-
/**
|
|
1151
|
-
* 显示最近应用
|
|
1152
|
-
* @returns 是否成功
|
|
1153
|
-
*/
|
|
1154
|
-
static recentApps(): boolean;
|
|
1155
|
-
/**
|
|
1156
|
-
* 在节点中粘贴文本
|
|
1157
|
-
* @param node 目标节点
|
|
1158
|
-
* @param text 要粘贴的文本
|
|
1159
|
-
* @returns 是否成功
|
|
1160
|
-
*/
|
|
1161
|
-
static paste(node: Node, text: string): boolean;
|
|
1162
|
-
static focus(node: Node): boolean;
|
|
1163
|
-
/**
|
|
1164
|
-
* 选择文本
|
|
1165
|
-
* @param node 目标节点
|
|
1166
|
-
* @param selectionStart 选择起始位置
|
|
1167
|
-
* @param selectionEnd 选择结束位置
|
|
1168
|
-
* @returns 是否成功
|
|
1169
|
-
*/
|
|
1170
|
-
static selectionText(node: Node, selectionStart: number, selectionEnd: number): boolean;
|
|
1171
|
-
/**
|
|
1172
|
-
* 向前滚动
|
|
1173
|
-
* @param node 可滚动节点
|
|
1174
|
-
* @returns 是否成功
|
|
1175
|
-
*/
|
|
1176
|
-
static scrollForward(node: Node): boolean;
|
|
1177
|
-
/**
|
|
1178
|
-
* 向后滚动
|
|
1179
|
-
* @param node 可滚动节点
|
|
1180
|
-
* @returns 是否成功
|
|
1181
|
-
*/
|
|
1182
|
-
static scrollBackward(node: Node): boolean;
|
|
1183
|
-
/**
|
|
1184
|
-
* 对节点执行点击手势
|
|
1185
|
-
* @param node 目标节点
|
|
1186
|
-
* @param offsetX X轴偏移
|
|
1187
|
-
* @param offsetY Y轴偏移
|
|
1188
|
-
* @param switchWindowIntervalDelay 窗口切换延迟
|
|
1189
|
-
* @param clickDuration 点击持续时间
|
|
1190
|
-
* @param timeout 超时时间(秒),默认30秒
|
|
1191
|
-
* @returns 是否成功
|
|
1192
|
-
*/
|
|
1193
|
-
static clickNodeByGesture(node: Node, { offsetX, offsetY, switchWindowIntervalDelay, clickDuration, timeout, }?: {
|
|
1194
|
-
offsetX?: number;
|
|
1195
|
-
offsetY?: number;
|
|
1196
|
-
switchWindowIntervalDelay?: number;
|
|
1197
|
-
clickDuration?: number;
|
|
1198
|
-
timeout?: number;
|
|
1199
|
-
}): Promise<boolean>;
|
|
1200
|
-
/**
|
|
1201
|
-
* 对节点执行双击手势
|
|
1202
|
-
* @param node 目标节点
|
|
1203
|
-
* @param offsetX X轴偏移
|
|
1204
|
-
* @param offsetY Y轴偏移
|
|
1205
|
-
* @param switchWindowIntervalDelay 窗口切换延迟
|
|
1206
|
-
* @param clickDuration 点击持续时间
|
|
1207
|
-
* @param clickInterval 点击间隔
|
|
1208
|
-
* @param timeout 超时时间(秒),默认30秒
|
|
1209
|
-
* @returns 是否成功
|
|
1210
|
-
*/
|
|
1211
|
-
static doubleClickNodeByGesture(node: Node, { offsetX, offsetY, switchWindowIntervalDelay, clickDuration, clickInterval, timeout, }?: {
|
|
1212
|
-
offsetX?: number;
|
|
1213
|
-
offsetY?: number;
|
|
1214
|
-
switchWindowIntervalDelay?: number;
|
|
1215
|
-
clickDuration?: number;
|
|
1216
|
-
clickInterval?: number;
|
|
1217
|
-
timeout?: number;
|
|
1218
|
-
}): Promise<boolean>;
|
|
1219
|
-
/**
|
|
1220
|
-
* 执行线型手势
|
|
1221
|
-
* @param startPoint
|
|
1222
|
-
* @param endPoint
|
|
1223
|
-
* @param param2
|
|
1224
|
-
* @param timeout 超时时间(秒),默认30秒
|
|
1225
|
-
* @returns
|
|
1226
|
-
*/
|
|
1227
|
-
static performLinearGesture(startPoint: {
|
|
1228
|
-
x: number;
|
|
1229
|
-
y: number;
|
|
1230
|
-
}, endPoint: {
|
|
1231
|
-
x: number;
|
|
1232
|
-
y: number;
|
|
1233
|
-
}, { duration, timeout }?: {
|
|
1234
|
-
duration?: number;
|
|
1235
|
-
timeout?: number;
|
|
1236
|
-
}): Promise<boolean>;
|
|
1237
|
-
static longPressNodeByGestureAutoPaste(node: Node, text: string, { matchedPackageName, matchedText, timeoutMillis, longPressDuration, timeout, }?: {
|
|
1238
|
-
matchedPackageName?: string;
|
|
1239
|
-
matchedText?: string;
|
|
1240
|
-
timeoutMillis?: number;
|
|
1241
|
-
longPressDuration?: number;
|
|
1242
|
-
timeout?: number;
|
|
1243
|
-
}): Promise<boolean>;
|
|
1244
|
-
static longPressGestureAutoPaste(point: {
|
|
1245
|
-
x: number;
|
|
1246
|
-
y: number;
|
|
1247
|
-
}, text: string, { matchedPackageName, matchedText, timeoutMillis, longPressDuration, timeout, }?: {
|
|
1248
|
-
matchedPackageName?: string;
|
|
1249
|
-
matchedText?: string;
|
|
1250
|
-
timeoutMillis?: number;
|
|
1251
|
-
longPressDuration?: number;
|
|
1252
|
-
timeout?: number;
|
|
1253
|
-
}): Promise<boolean>;
|
|
1254
|
-
static getAppInfo(packageName: string, timeout?: number): Promise<AppInfo>;
|
|
1255
|
-
static getUniqueDeviceId(): any;
|
|
1256
|
-
static getAndroidID(): any;
|
|
1257
|
-
static getMacAddress(timeout?: number): Promise<any>;
|
|
1258
|
-
static getDeviceInfo(timeout?: number): Promise<DeviceInfo>;
|
|
1259
|
-
static getNetworkType(timeout?: number): Promise<any>;
|
|
1260
|
-
/**
|
|
1261
|
-
* 播放系统电话铃声
|
|
1262
|
-
* @param timeout 超时时间(秒),默认30秒
|
|
1263
|
-
* @returns 播放结果消息
|
|
1264
|
-
*/
|
|
1265
|
-
static audioPlayRingtone(timeout?: number): Promise<string>;
|
|
1266
|
-
/**
|
|
1267
|
-
* 停止播放系统电话铃声
|
|
1268
|
-
* @param timeout 超时时间(秒),默认30秒
|
|
1269
|
-
* @returns 停止结果消息
|
|
1270
|
-
*/
|
|
1271
|
-
static audioStopRingtone(timeout?: number): Promise<string>;
|
|
1272
|
-
static setAccessibilityEventFilters(value: AccessibilityEventFilter[]): Promise<any>;
|
|
1273
|
-
static addAccessibilityEventFilter(value: AccessibilityEventFilter): Promise<any>;
|
|
1274
|
-
/**
|
|
1275
|
-
* 获取屏幕尺寸
|
|
1276
|
-
* @returns 屏幕尺寸对象(width, height)
|
|
1277
|
-
*/
|
|
1278
|
-
static getScreenSize(): Screen | null;
|
|
1279
|
-
/**
|
|
1280
|
-
* 获取应用窗口尺寸
|
|
1281
|
-
* @returns 应用窗口尺寸对象
|
|
1282
|
-
*/
|
|
1283
|
-
static getAppScreenSize(): any;
|
|
1284
|
-
/**
|
|
1285
|
-
* 添加无障碍事件监听器
|
|
1286
|
-
* @param listener 监听器函数
|
|
1287
|
-
*/
|
|
1288
|
-
static addAccessibilityEventListener(listener: AccessibilityEventListener): void;
|
|
1289
|
-
/**
|
|
1290
|
-
* 判断是否包含无障碍事件监听器
|
|
1291
|
-
* @param listener 监听器函数
|
|
1292
|
-
* @returns 是否包含
|
|
1293
|
-
*/
|
|
1294
|
-
static containsAccessibilityEventListener(listener: AccessibilityEventListener): boolean;
|
|
1295
|
-
/**
|
|
1296
|
-
* 移除无障碍事件监听器
|
|
1297
|
-
* @param listener 要移除的监听器函数
|
|
1298
|
-
* @returns 是否移除成功
|
|
1299
|
-
*/
|
|
1300
|
-
static removeAccessibilityEventListener(listener: AccessibilityEventListener): boolean;
|
|
1301
|
-
/**
|
|
1302
|
-
* 移除所有无障碍事件监听器
|
|
1303
|
-
*/
|
|
1304
|
-
static removeAllAccessibilityEventListeners(): void;
|
|
1305
|
-
/**
|
|
1306
|
-
* 获取当前注册的无障碍事件监听器数量
|
|
1307
|
-
* @returns 监听器数量
|
|
1308
|
-
*/
|
|
1309
|
-
static getAccessibilityEventListenerCount(): number;
|
|
1310
|
-
}
|
|
1311
|
-
|
|
1312
|
-
declare const CallMethod: {
|
|
1313
|
-
readonly takeScreenshot: "takeScreenshot";
|
|
1314
|
-
readonly takeScreenshotSave: "takeScreenshotSave";
|
|
1315
|
-
readonly takeScreenshotToFile: "takeScreenshotToFile";
|
|
1316
|
-
readonly overlayToast: "overlayToast";
|
|
1317
|
-
readonly setNodeText: "setNodeText";
|
|
1318
|
-
readonly findByTags: "findByTags";
|
|
1319
|
-
readonly findById: "findById";
|
|
1320
|
-
readonly findByText: "findByText";
|
|
1321
|
-
readonly findByTextAllMatch: "findByTextAllMatch";
|
|
1322
|
-
readonly containsText: "containsText";
|
|
1323
|
-
readonly getAllText: "getAllText";
|
|
1324
|
-
readonly findFirstParentByTags: "findFirstParentByTags";
|
|
1325
|
-
readonly getAllNodes: "getAllNodes";
|
|
1326
|
-
readonly getNodes: "getNodes";
|
|
1327
|
-
readonly findFirstParentClickable: "findFirstParentClickable";
|
|
1328
|
-
readonly getChildren: "getChildren";
|
|
1329
|
-
readonly getBoundsInScreen: "getBoundsInScreen";
|
|
1330
|
-
readonly isVisible: "isVisible";
|
|
1331
|
-
readonly click: "click";
|
|
1332
|
-
readonly longClick: "longClick";
|
|
1333
|
-
readonly back: "back";
|
|
1334
|
-
readonly home: "home";
|
|
1335
|
-
readonly notifications: "notifications";
|
|
1336
|
-
readonly recentApps: "recentApps";
|
|
1337
|
-
readonly paste: "paste";
|
|
1338
|
-
readonly focus: "focus";
|
|
1339
|
-
readonly selectionText: "selectionText";
|
|
1340
|
-
readonly scrollForward: "scrollForward";
|
|
1341
|
-
readonly launchApp: "launchApp";
|
|
1342
|
-
readonly getPackageName: "getPackageName";
|
|
1343
|
-
readonly getScreenSize: "getScreenSize";
|
|
1344
|
-
readonly getAppScreenSize: "getAppScreenSize";
|
|
1345
|
-
readonly scrollBackward: "scrollBackward";
|
|
1346
|
-
readonly setOverlayFlags: "setOverlayFlags";
|
|
1347
|
-
readonly scanQR: "scanQR";
|
|
1348
|
-
readonly loadWebViewOverlay: "loadWebViewOverlay";
|
|
1349
|
-
readonly closeOverlay: "closeOverlay";
|
|
1350
|
-
readonly recognizeTextInScreenshot: "recognizeTextInScreenshot";
|
|
1351
|
-
readonly clickByGesture: "clickByGesture";
|
|
1352
|
-
readonly clickNodeByGesture: "clickNodeByGesture";
|
|
1353
|
-
readonly doubleClickNodeByGesture: "doubleClickNodeByGesture";
|
|
1354
|
-
readonly performLinearGesture: "performLinearGesture";
|
|
1355
|
-
readonly longPressGestureAutoPaste: "longPressGestureAutoPaste";
|
|
1356
|
-
readonly getAppInfo: "getAppInfo";
|
|
1357
|
-
readonly getMacAddress: "getMacAddress";
|
|
1358
|
-
readonly getAndroidID: "getAndroidID";
|
|
1359
|
-
readonly getUniqueDeviceId: "getUniqueDeviceId";
|
|
1360
|
-
readonly addAccessibilityEventFilter: "addAccessibilityEventFilter";
|
|
1361
|
-
readonly setAccessibilityEventFilters: "setAccessibilityEventFilters";
|
|
1362
|
-
readonly httpRequest: "httpRequest";
|
|
1363
|
-
readonly getDeviceInfo: "getDeviceInfo";
|
|
1364
|
-
readonly getNetworkType: "getNetworkType";
|
|
1365
|
-
readonly isAppInstalled: "isAppInstalled";
|
|
1366
|
-
readonly getClipboardLatestText: "getClipboardLatestText";
|
|
1367
|
-
readonly getClipboardText: "getClipboardText";
|
|
1368
|
-
readonly openUrlInBrowser: "openUrlInBrowser";
|
|
1369
|
-
readonly keepScreenOn: "keepScreenOn";
|
|
1370
|
-
readonly clearKeepScreenOn: "clearKeepScreenOn";
|
|
1371
|
-
readonly download: "download";
|
|
1372
|
-
readonly audioPlayFromFile: "audioPlayFromFile";
|
|
1373
|
-
readonly audioStop: "audioStop";
|
|
1374
|
-
readonly audioPlayRingtone: "audioPlayRingtone";
|
|
1375
|
-
readonly audioStopRingtone: "audioStopRingtone";
|
|
1376
|
-
readonly addContact: "addContact";
|
|
1377
|
-
readonly getAllContacts: "getAllContacts";
|
|
1378
|
-
readonly saveRootNodeTreeJson: "saveRootNodeTreeJson";
|
|
1379
|
-
};
|
|
1380
|
-
type CallMethodType = (typeof CallMethod)[keyof typeof CallMethod];
|
|
1381
|
-
|
|
1382
|
-
/**
|
|
1383
|
-
* Android 视图类型常量
|
|
1384
|
-
*/
|
|
1385
|
-
declare const NodeClassValue: {
|
|
1386
|
-
readonly ImageView: "android.widget.ImageView";
|
|
1387
|
-
readonly TextView: "android.widget.TextView";
|
|
1388
|
-
readonly LinearLayout: "android.widget.LinearLayout";
|
|
1389
|
-
readonly RelativeLayout: "android.widget.RelativeLayout";
|
|
1390
|
-
readonly Button: "android.widget.Button";
|
|
1391
|
-
readonly ImageButton: "android.widget.ImageButton";
|
|
1392
|
-
readonly EditText: "android.widget.EditText";
|
|
1393
|
-
readonly View: "android.view.View";
|
|
1394
|
-
readonly ViewGroup: "android.view.ViewGroup";
|
|
1395
|
-
readonly FrameLayout: "android.widget.FrameLayout";
|
|
1396
|
-
};
|
|
1397
|
-
|
|
1398
|
-
declare function sleep(ms: number): Promise<void>;
|
|
1399
|
-
declare function generateUUID(): string;
|
|
1400
|
-
declare function decodeBase64UTF8(base64: string): string;
|
|
1401
|
-
|
|
1402
|
-
/**
|
|
1403
|
-
* 步骤执行错误类
|
|
1404
|
-
* 用于携带步骤执行过程中的错误信息和当前步骤对象
|
|
1405
|
-
* 支持传入可选数据:message,data任何类型的数据
|
|
1406
|
-
*/
|
|
1407
|
-
declare class StepError extends Error {
|
|
1408
|
-
/**
|
|
1409
|
-
* 步骤实现函数名
|
|
1410
|
-
*/
|
|
1411
|
-
readonly impl?: string;
|
|
1412
|
-
/**
|
|
1413
|
-
* 步骤标签
|
|
1414
|
-
*/
|
|
1415
|
-
readonly tag?: string | undefined;
|
|
1416
|
-
/**
|
|
1417
|
-
* 步骤数据,可以是任何类型
|
|
1418
|
-
*/
|
|
1419
|
-
readonly data?: any;
|
|
1420
|
-
/**
|
|
1421
|
-
* 原始错误
|
|
1422
|
-
*/
|
|
1423
|
-
readonly originalError?: any;
|
|
1424
|
-
/**
|
|
1425
|
-
* 当前步骤对象
|
|
1426
|
-
*/
|
|
1427
|
-
readonly currentStep?: any;
|
|
1428
|
-
constructor(message?: string, data?: any, impl?: string, tag?: string | undefined, originalError?: any, currentStep?: any | undefined);
|
|
1429
|
-
}
|
|
1430
|
-
/**
|
|
1431
|
-
* 主动停止异常类
|
|
1432
|
-
* 用于表示步骤被主动停止执行
|
|
1433
|
-
*/
|
|
1434
|
-
declare class StepStopError extends StepError {
|
|
1435
|
-
constructor(message?: string, data?: any);
|
|
1436
|
-
}
|
|
1437
|
-
|
|
1438
|
-
declare class StepAsync {
|
|
1439
|
-
private step;
|
|
1440
|
-
/**
|
|
1441
|
-
* 构造函数
|
|
1442
|
-
* @param step Step实例
|
|
375
|
+
* 在浏览器中打开URL
|
|
376
|
+
* @param url 要打开的URL
|
|
377
|
+
* @returns 是否成功打开
|
|
1443
378
|
*/
|
|
1444
|
-
|
|
379
|
+
static openUrlInBrowser(url: string): boolean;
|
|
1445
380
|
/**
|
|
1446
|
-
*
|
|
1447
|
-
* @param
|
|
1448
|
-
* @
|
|
1449
|
-
* @returns 截图路径
|
|
381
|
+
* 保持屏幕常亮
|
|
382
|
+
* @param tip 提示文本
|
|
383
|
+
* @returns 是否保持屏幕常亮成功
|
|
1450
384
|
*/
|
|
1451
|
-
|
|
385
|
+
static keepScreenOn(tip?: string): boolean;
|
|
386
|
+
static clearKeepScreenOn(): boolean;
|
|
387
|
+
static isAppInstalled(packageName: string): boolean;
|
|
1452
388
|
/**
|
|
1453
|
-
*
|
|
1454
|
-
* @param nodes
|
|
389
|
+
* 对指定节点进行截图
|
|
390
|
+
* @param nodes 要截图的节点数组
|
|
1455
391
|
* @param overlayHiddenScreenshotDelayMillis 截图延迟时间(毫秒)
|
|
392
|
+
* @param timeout 超时时间(秒),默认30秒
|
|
1456
393
|
* @returns 截图路径数组
|
|
1457
394
|
*/
|
|
1458
|
-
takeScreenshotNodes(nodes: Node[], overlayHiddenScreenshotDelayMillis?: number): Promise<string[]>;
|
|
395
|
+
static takeScreenshotNodes(nodes: Node[], overlayHiddenScreenshotDelayMillis?: number, timeout?: number): Promise<string[]>;
|
|
396
|
+
static scanQR(timeout?: number): Promise<string>;
|
|
397
|
+
static loadWebViewOverlay(url: string, options?: WebFloatingWindowOptions & {
|
|
398
|
+
timeout?: number;
|
|
399
|
+
}): Promise<any>;
|
|
1459
400
|
/**
|
|
1460
|
-
*
|
|
1461
|
-
* @param
|
|
1462
|
-
* @
|
|
1463
|
-
* @param filterDes 描述过滤
|
|
1464
|
-
* @param filterText 文本过滤
|
|
1465
|
-
* @returns 节点数组
|
|
401
|
+
* 点击节点
|
|
402
|
+
* @param node 要点击的节点
|
|
403
|
+
* @returns 是否点击成功
|
|
1466
404
|
*/
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
405
|
+
static click(node: Node): boolean;
|
|
406
|
+
/**
|
|
407
|
+
* 长按节点
|
|
408
|
+
* @param node 要长按的节点
|
|
409
|
+
* @returns 是否长按成功
|
|
410
|
+
*/
|
|
411
|
+
static longClick(node: Node): boolean;
|
|
1473
412
|
/**
|
|
1474
413
|
* 启动应用
|
|
1475
414
|
* @param packageName 应用包名
|
|
1476
415
|
* @returns 是否启动成功
|
|
1477
416
|
*/
|
|
1478
|
-
launchApp(packageName: string):
|
|
417
|
+
static launchApp(packageName: string): boolean;
|
|
1479
418
|
/**
|
|
1480
419
|
* 获取当前应用包名
|
|
1481
420
|
* @returns 包名
|
|
1482
421
|
*/
|
|
1483
|
-
getPackageName(
|
|
422
|
+
static getPackageName(options?: {
|
|
423
|
+
scope?: NodeLookupScope;
|
|
424
|
+
}): string;
|
|
425
|
+
/**
|
|
426
|
+
* 显示悬浮提示
|
|
427
|
+
* @param text 提示文本
|
|
428
|
+
* @param delay 显示时长(毫秒)
|
|
429
|
+
* @returns 是否显示成功
|
|
430
|
+
*/
|
|
431
|
+
static overlayToast(text: string, delay?: number): boolean;
|
|
1484
432
|
/**
|
|
1485
433
|
* 通过ID查找节点
|
|
1486
434
|
* @param id 节点ID
|
|
1487
435
|
* @param filterClass 类名过滤
|
|
1488
436
|
* @param filterText 文本过滤
|
|
1489
437
|
* @param filterDes 描述过滤
|
|
438
|
+
* @param node 父节点范围
|
|
1490
439
|
* @returns 节点数组
|
|
1491
440
|
*/
|
|
1492
|
-
findById(id: string, { filterClass, filterText, filterDes, }?: {
|
|
441
|
+
static findById(id: string, { filterClass, filterText, filterDes, node, scope, }?: {
|
|
1493
442
|
filterClass?: string;
|
|
1494
443
|
filterText?: string;
|
|
1495
444
|
filterDes?: string;
|
|
1496
|
-
|
|
445
|
+
node?: Node;
|
|
446
|
+
scope?: NodeLookupScope;
|
|
447
|
+
}): Node[];
|
|
1497
448
|
/**
|
|
1498
449
|
* 通过文本查找节点
|
|
1499
450
|
* @param text 要查找的文本
|
|
1500
451
|
* @param filterClass 类名过滤
|
|
1501
452
|
* @param filterViewId 视图ID过滤
|
|
1502
453
|
* @param filterDes 描述过滤
|
|
454
|
+
* @param node 父节点范围
|
|
1503
455
|
* @returns 节点数组
|
|
1504
456
|
*/
|
|
1505
|
-
findByText(text: string, { filterClass, filterViewId, filterDes, }?: {
|
|
457
|
+
static findByText(text: string, { filterClass, filterViewId, filterDes, node, scope, }?: {
|
|
1506
458
|
filterClass?: string;
|
|
1507
459
|
filterViewId?: string;
|
|
1508
460
|
filterDes?: string;
|
|
1509
|
-
|
|
461
|
+
node?: Node;
|
|
462
|
+
scope?: NodeLookupScope;
|
|
463
|
+
}): Node[];
|
|
1510
464
|
/**
|
|
1511
465
|
* 通过标签查找节点
|
|
1512
466
|
* @param className 类名
|
|
1513
467
|
* @param filterText 文本过滤
|
|
1514
468
|
* @param filterViewId 视图ID过滤
|
|
1515
469
|
* @param filterDes 描述过滤
|
|
470
|
+
* @param node 父节点范围
|
|
1516
471
|
* @returns 节点数组
|
|
1517
472
|
*/
|
|
1518
|
-
findByTags(className: string, { filterText, filterViewId, filterDes, }?: {
|
|
473
|
+
static findByTags(className: string, { filterText, filterViewId, filterDes, node, scope, }?: {
|
|
1519
474
|
filterText?: string;
|
|
1520
475
|
filterViewId?: string;
|
|
1521
476
|
filterDes?: string;
|
|
1522
|
-
|
|
477
|
+
node?: Node;
|
|
478
|
+
scope?: NodeLookupScope;
|
|
479
|
+
}): Node[];
|
|
1523
480
|
/**
|
|
1524
481
|
* 查找所有匹配文本的节点
|
|
1525
482
|
* @param text 要查找的文本
|
|
1526
|
-
* @
|
|
483
|
+
* @param options.scope 节点查找范围(可选)
|
|
1527
484
|
*/
|
|
1528
|
-
findByTextAllMatch(text: string
|
|
485
|
+
static findByTextAllMatch(text: string, { scope }?: {
|
|
486
|
+
scope?: NodeLookupScope;
|
|
487
|
+
}): Node[];
|
|
1529
488
|
/**
|
|
1530
489
|
* 检查是否包含指定文本
|
|
1531
490
|
* @param text 要检查的文本
|
|
1532
491
|
* @returns 是否包含
|
|
1533
492
|
*/
|
|
1534
|
-
containsText(text: string):
|
|
493
|
+
static containsText(text: string): boolean;
|
|
1535
494
|
/**
|
|
1536
495
|
* 获取所有文本
|
|
1537
496
|
* @returns 文本数组
|
|
1538
497
|
*/
|
|
1539
|
-
getAllText():
|
|
1540
|
-
/**
|
|
1541
|
-
* 执行点击手势
|
|
1542
|
-
* @param x 横坐标
|
|
1543
|
-
* @param y 纵坐标
|
|
1544
|
-
* @param duration 持续时间(毫秒)
|
|
1545
|
-
* @returns 是否成功
|
|
1546
|
-
*/
|
|
1547
|
-
clickByGesture(x: number, y: number, duration: number): Promise<boolean>;
|
|
1548
|
-
longPressGestureAutoPaste(point: {
|
|
1549
|
-
x: number;
|
|
1550
|
-
y: number;
|
|
1551
|
-
}, text: string, { matchedPackageName, matchedText, timeoutMillis, longPressDuration, }?: {
|
|
1552
|
-
matchedPackageName?: string;
|
|
1553
|
-
matchedText?: string;
|
|
1554
|
-
timeoutMillis?: number;
|
|
1555
|
-
longPressDuration?: number;
|
|
1556
|
-
}): Promise<boolean>;
|
|
1557
|
-
getAppInfo(packageName: string): Promise<any>;
|
|
1558
|
-
performLinearGesture(startPoint: {
|
|
1559
|
-
x: number;
|
|
1560
|
-
y: number;
|
|
1561
|
-
}, endPoint: {
|
|
1562
|
-
x: number;
|
|
1563
|
-
y: number;
|
|
1564
|
-
}, { duration }?: {
|
|
1565
|
-
duration?: number;
|
|
1566
|
-
}): Promise<boolean>;
|
|
1567
|
-
/**
|
|
1568
|
-
* 返回操作
|
|
1569
|
-
* @returns 是否成功
|
|
1570
|
-
*/
|
|
1571
|
-
back(): Promise<boolean>;
|
|
1572
|
-
/**
|
|
1573
|
-
* 回到主页
|
|
1574
|
-
* @returns 是否成功
|
|
1575
|
-
*/
|
|
1576
|
-
home(): Promise<boolean>;
|
|
1577
|
-
/**
|
|
1578
|
-
* 打开通知栏
|
|
1579
|
-
* @returns 是否成功
|
|
1580
|
-
*/
|
|
1581
|
-
notifications(): Promise<boolean>;
|
|
1582
|
-
/**
|
|
1583
|
-
* 显示最近应用
|
|
1584
|
-
* @returns 是否成功
|
|
1585
|
-
*/
|
|
1586
|
-
recentApps(): Promise<boolean>;
|
|
1587
|
-
/**
|
|
1588
|
-
* 获取屏幕尺寸
|
|
1589
|
-
* @returns 屏幕尺寸对象
|
|
1590
|
-
*/
|
|
1591
|
-
getScreenSize(): Promise<any>;
|
|
1592
|
-
/**
|
|
1593
|
-
* 获取应用窗口尺寸
|
|
1594
|
-
* @returns 应用窗口尺寸对象
|
|
1595
|
-
*/
|
|
1596
|
-
getAppScreenSize(): Promise<any>;
|
|
1597
|
-
}
|
|
1598
|
-
|
|
1599
|
-
type StepResult = Step | undefined;
|
|
1600
|
-
type StepImpl = (step: Step) => Promise<StepResult>;
|
|
1601
|
-
type StepInterceptor = (step: Step) => StepResult | Promise<StepResult>;
|
|
1602
|
-
declare class Step {
|
|
1603
|
-
static delayMsDefault: number;
|
|
1604
|
-
static readonly repeatCountInfinite: number;
|
|
1605
|
-
static repeatCountMaxDefault: number;
|
|
1606
|
-
static showLog: boolean;
|
|
1607
|
-
static exceptionRetryCountMaxDefault: number;
|
|
1608
|
-
/**
|
|
1609
|
-
* 当前执行步骤的ID
|
|
1610
|
-
*/
|
|
1611
|
-
private static _stepId;
|
|
1612
|
-
/**
|
|
1613
|
-
* 步骤拦截器列表
|
|
1614
|
-
*/
|
|
1615
|
-
private static _interceptors;
|
|
1616
|
-
/**
|
|
1617
|
-
* 步骤异常变量,默认为空
|
|
1618
|
-
*/
|
|
1619
|
-
static exception: StepError | undefined;
|
|
1620
|
-
/**
|
|
1621
|
-
* 运行步骤实现
|
|
1622
|
-
* @param impl 步骤实现函数
|
|
1623
|
-
* @param tag 步骤标签
|
|
1624
|
-
* @param data 步骤数据
|
|
1625
|
-
* @param delayMs 步骤延迟时间(毫秒)
|
|
1626
|
-
*/
|
|
1627
|
-
static run(impl: StepImpl, { stepId, tag, data, delayMs, exceptionRetryCountMax, }?: {
|
|
1628
|
-
stepId?: string | undefined;
|
|
1629
|
-
tag?: string | undefined;
|
|
1630
|
-
data?: any | undefined;
|
|
1631
|
-
delayMs?: number;
|
|
1632
|
-
exceptionRetryCountMax?: number;
|
|
1633
|
-
}): Promise<Step | undefined>;
|
|
1634
|
-
/**
|
|
1635
|
-
* 获取当前步骤ID
|
|
1636
|
-
*/
|
|
1637
|
-
static get stepId(): string | undefined;
|
|
1638
|
-
/**
|
|
1639
|
-
* 验证步骤ID是否匹配,如果不匹配则表示停止
|
|
1640
|
-
* @param stepId 要验证的步骤ID
|
|
1641
|
-
*/
|
|
1642
|
-
static assert(stepId: string | undefined): void;
|
|
1643
|
-
/**
|
|
1644
|
-
* 为节点数组分配步骤ID
|
|
1645
|
-
* @param nodes 节点数组
|
|
1646
|
-
* @param stepId 步骤ID
|
|
1647
|
-
*/
|
|
1648
|
-
static assignIdsToNodes(nodes: Node[], stepId: string | undefined): void;
|
|
1649
|
-
/**
|
|
1650
|
-
* 停止当前步骤执行
|
|
1651
|
-
* @param exception 可选的异常对象,如果传入则使用该异常,否则使用默认的StepStopError
|
|
1652
|
-
*/
|
|
1653
|
-
static stop(exception?: StepError): void;
|
|
1654
|
-
/**
|
|
1655
|
-
* 添加步骤拦截器
|
|
1656
|
-
* @param interceptor 拦截器函数
|
|
1657
|
-
*/
|
|
1658
|
-
static addInterceptor(interceptor: StepInterceptor): void;
|
|
1659
|
-
/**
|
|
1660
|
-
* 移除步骤拦截器
|
|
1661
|
-
* @param interceptor 要移除的拦截器函数
|
|
1662
|
-
* @returns 是否成功删除
|
|
1663
|
-
*/
|
|
1664
|
-
static removeInterceptor(interceptor: StepInterceptor): boolean;
|
|
1665
|
-
/**
|
|
1666
|
-
* 按索引移除步骤拦截器
|
|
1667
|
-
* @param index 要移除的拦截器索引
|
|
1668
|
-
* @returns 是否成功删除
|
|
1669
|
-
*/
|
|
1670
|
-
static removeInterceptorByIndex(index: number): boolean;
|
|
1671
|
-
/**
|
|
1672
|
-
* 移除所有匹配的步骤拦截器
|
|
1673
|
-
* @param interceptor 要移除的拦截器函数
|
|
1674
|
-
* @returns 删除的拦截器数量
|
|
1675
|
-
*/
|
|
1676
|
-
static removeAllInterceptors(interceptor: StepInterceptor): number;
|
|
1677
|
-
/**
|
|
1678
|
-
* 按条件移除步骤拦截器
|
|
1679
|
-
* @param predicate 判断是否删除的条件函数
|
|
1680
|
-
* @returns 删除的拦截器数量
|
|
1681
|
-
*/
|
|
1682
|
-
static removeInterceptorByPredicate(predicate: (interceptor: StepInterceptor, index: number) => boolean): number;
|
|
1683
|
-
/**
|
|
1684
|
-
* 清空所有拦截器
|
|
1685
|
-
*/
|
|
1686
|
-
static clearInterceptors(): void;
|
|
1687
|
-
/**
|
|
1688
|
-
* 获取所有拦截器
|
|
1689
|
-
* @returns 拦截器数组
|
|
1690
|
-
*/
|
|
1691
|
-
static getInterceptors(): StepInterceptor[];
|
|
1692
|
-
/**
|
|
1693
|
-
* 步骤ID
|
|
1694
|
-
*/
|
|
1695
|
-
stepId: string;
|
|
1696
|
-
/**
|
|
1697
|
-
* 步骤重复执行次数
|
|
1698
|
-
*/
|
|
1699
|
-
repeatCount: number;
|
|
1700
|
-
/**
|
|
1701
|
-
* 步骤重复执行最大次数,默认15次
|
|
1702
|
-
*/
|
|
1703
|
-
repeatCountMax: number;
|
|
1704
|
-
/**
|
|
1705
|
-
* 异常重试次数
|
|
1706
|
-
*/
|
|
1707
|
-
exceptionRetryCount: number;
|
|
1708
|
-
/**
|
|
1709
|
-
* 异常重试最大次数,默认3次
|
|
1710
|
-
*/
|
|
1711
|
-
exceptionRetryCountMax: number;
|
|
1712
|
-
/**
|
|
1713
|
-
* 步骤标签
|
|
1714
|
-
*/
|
|
1715
|
-
tag: string | undefined;
|
|
1716
|
-
isEnd: boolean;
|
|
1717
|
-
/**
|
|
1718
|
-
* 步骤数据
|
|
1719
|
-
*/
|
|
1720
|
-
data: any | undefined;
|
|
1721
|
-
/**
|
|
1722
|
-
* 步骤延迟时间(毫秒)
|
|
1723
|
-
*/
|
|
1724
|
-
delayMs: number;
|
|
1725
|
-
/**
|
|
1726
|
-
* 步骤实现函数
|
|
1727
|
-
*/
|
|
1728
|
-
impl: StepImpl | undefined;
|
|
498
|
+
static getAllText(): string[];
|
|
1729
499
|
/**
|
|
1730
|
-
*
|
|
1731
|
-
* @param
|
|
1732
|
-
* @
|
|
1733
|
-
* @param tag 步骤标签
|
|
1734
|
-
* @param data 步骤数据
|
|
1735
|
-
* @param delayMs 步骤延迟时间(毫秒)
|
|
500
|
+
* 查找第一个匹配标签的父节点
|
|
501
|
+
* @param className 类名
|
|
502
|
+
* @returns 父节点
|
|
1736
503
|
*/
|
|
1737
|
-
|
|
1738
|
-
stepId: string;
|
|
1739
|
-
impl: StepImpl | undefined;
|
|
1740
|
-
tag?: string | undefined;
|
|
1741
|
-
data?: any | undefined;
|
|
1742
|
-
delayMs?: number;
|
|
1743
|
-
repeatCountMax?: number;
|
|
1744
|
-
exceptionRetryCountMax?: number;
|
|
1745
|
-
isEnd?: boolean;
|
|
1746
|
-
});
|
|
1747
|
-
get async(): StepAsync;
|
|
504
|
+
static findFirstParentByTags(node: Node, className: string): Node;
|
|
1748
505
|
/**
|
|
1749
|
-
*
|
|
1750
|
-
* @param
|
|
1751
|
-
* @
|
|
1752
|
-
* @param data 步骤数据
|
|
1753
|
-
* @param delayMs 步骤延迟时间(毫秒)
|
|
1754
|
-
* @returns 新的步骤实例
|
|
506
|
+
* 获取节点的所有子节点
|
|
507
|
+
* @param node 父节点
|
|
508
|
+
* @returns 子节点数组
|
|
1755
509
|
*/
|
|
1756
|
-
|
|
1757
|
-
tag?: string | undefined;
|
|
1758
|
-
data?: any | undefined;
|
|
1759
|
-
delayMs?: number;
|
|
1760
|
-
repeatCountMax?: number;
|
|
1761
|
-
exceptionRetryCountMax?: number;
|
|
1762
|
-
}): Step;
|
|
1763
|
-
end({ tag, data, delayMs, repeatCountMax, exceptionRetryCountMax, }?: {
|
|
1764
|
-
tag?: string | undefined;
|
|
1765
|
-
data?: any | undefined;
|
|
1766
|
-
delayMs?: number;
|
|
1767
|
-
repeatCountMax?: number;
|
|
1768
|
-
exceptionRetryCountMax?: number;
|
|
1769
|
-
}): Step;
|
|
510
|
+
static getNodes(node: Node): Node[];
|
|
1770
511
|
/**
|
|
1771
|
-
*
|
|
1772
|
-
* @param
|
|
1773
|
-
* @
|
|
1774
|
-
* @param data 步骤数据
|
|
1775
|
-
* @param delayMs 步骤延迟时间(毫秒)
|
|
1776
|
-
* @returns 当前步骤实例
|
|
512
|
+
* 获取节点的直接子节点
|
|
513
|
+
* @param node 父节点
|
|
514
|
+
* @returns 子节点数组
|
|
1777
515
|
*/
|
|
1778
|
-
|
|
1779
|
-
stepId?: string;
|
|
1780
|
-
tag?: string | undefined;
|
|
1781
|
-
data?: any | undefined;
|
|
1782
|
-
delayMs?: number;
|
|
1783
|
-
repeatCountMax?: number;
|
|
1784
|
-
exceptionRetryCountMax?: number;
|
|
1785
|
-
}): Step;
|
|
516
|
+
static getChildren(node: Node): Node[];
|
|
1786
517
|
/**
|
|
1787
|
-
*
|
|
1788
|
-
* @param
|
|
1789
|
-
* @returns
|
|
518
|
+
* 查找第一个可点击的父节点
|
|
519
|
+
* @param node 起始节点
|
|
520
|
+
* @returns 可点击的父节点
|
|
1790
521
|
*/
|
|
1791
|
-
|
|
522
|
+
static findFirstParentClickable(node: Node): Node;
|
|
1792
523
|
/**
|
|
1793
|
-
*
|
|
1794
|
-
* @param
|
|
1795
|
-
* @returns
|
|
524
|
+
* 获取节点在屏幕中的边界
|
|
525
|
+
* @param node 目标节点
|
|
526
|
+
* @returns 边界对象
|
|
1796
527
|
*/
|
|
1797
|
-
|
|
528
|
+
static getBoundsInScreen(node: Node): Bounds;
|
|
1798
529
|
/**
|
|
1799
|
-
*
|
|
530
|
+
* 检查节点是否可见
|
|
1800
531
|
* @param node 目标节点
|
|
1801
|
-
* @param
|
|
1802
|
-
* @
|
|
532
|
+
* @param compareNode 比较节点
|
|
533
|
+
* @param isFullyByCompareNode 是否完全可见
|
|
534
|
+
* @returns 是否可见
|
|
1803
535
|
*/
|
|
1804
|
-
|
|
536
|
+
static isVisible(node: Node, { compareNode, isFullyByCompareNode, }?: {
|
|
537
|
+
compareNode?: Node;
|
|
538
|
+
isFullyByCompareNode?: boolean;
|
|
539
|
+
}): boolean;
|
|
1805
540
|
/**
|
|
1806
|
-
*
|
|
1807
|
-
* @param
|
|
1808
|
-
* @param
|
|
1809
|
-
* @
|
|
541
|
+
* 执行点击手势
|
|
542
|
+
* @param x 横坐标
|
|
543
|
+
* @param y 纵坐标
|
|
544
|
+
* @param duration 持续时间
|
|
545
|
+
* @param timeout 超时时间(秒),默认30秒
|
|
546
|
+
* @returns 是否成功
|
|
1810
547
|
*/
|
|
1811
|
-
|
|
548
|
+
static clickByGesture(x: number, y: number, duration: number, timeout?: number): Promise<boolean>;
|
|
1812
549
|
/**
|
|
1813
|
-
*
|
|
1814
|
-
* @
|
|
1815
|
-
* @param filterViewId 视图ID过滤
|
|
1816
|
-
* @param filterDes 描述过滤
|
|
1817
|
-
* @param filterText 文本过滤
|
|
1818
|
-
* @returns 节点数组
|
|
550
|
+
* 返回操作
|
|
551
|
+
* @returns 是否成功
|
|
1819
552
|
*/
|
|
1820
|
-
|
|
1821
|
-
filterClass?: string;
|
|
1822
|
-
filterViewId?: string;
|
|
1823
|
-
filterDes?: string;
|
|
1824
|
-
filterText?: string;
|
|
1825
|
-
}): Node[];
|
|
553
|
+
static back(): boolean;
|
|
1826
554
|
/**
|
|
1827
|
-
*
|
|
1828
|
-
* @
|
|
1829
|
-
* @returns 是否启动成功
|
|
555
|
+
* 回到主页
|
|
556
|
+
* @returns 是否成功
|
|
1830
557
|
*/
|
|
1831
|
-
|
|
558
|
+
static home(): boolean;
|
|
1832
559
|
/**
|
|
1833
|
-
*
|
|
1834
|
-
* @returns
|
|
560
|
+
* 打开通知栏
|
|
561
|
+
* @returns 是否成功
|
|
1835
562
|
*/
|
|
1836
|
-
|
|
563
|
+
static notifications(): boolean;
|
|
1837
564
|
/**
|
|
1838
|
-
*
|
|
1839
|
-
* @
|
|
1840
|
-
* @param filterClass 类名过滤
|
|
1841
|
-
* @param filterText 文本过滤
|
|
1842
|
-
* @param filterDes 描述过滤
|
|
1843
|
-
* @returns 节点数组
|
|
565
|
+
* 显示最近应用
|
|
566
|
+
* @returns 是否成功
|
|
1844
567
|
*/
|
|
1845
|
-
|
|
1846
|
-
filterClass?: string;
|
|
1847
|
-
filterText?: string;
|
|
1848
|
-
filterDes?: string;
|
|
1849
|
-
}): Node[];
|
|
568
|
+
static recentApps(): boolean;
|
|
1850
569
|
/**
|
|
1851
|
-
*
|
|
1852
|
-
* @param
|
|
1853
|
-
* @param
|
|
1854
|
-
* @
|
|
1855
|
-
* @param filterDes 描述过滤
|
|
1856
|
-
* @returns 节点数组
|
|
570
|
+
* 在节点中粘贴文本
|
|
571
|
+
* @param node 目标节点
|
|
572
|
+
* @param text 要粘贴的文本
|
|
573
|
+
* @returns 是否成功
|
|
1857
574
|
*/
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
|
|
1864
|
-
*
|
|
1865
|
-
* @
|
|
1866
|
-
* @param filterText 文本过滤
|
|
1867
|
-
* @param filterViewId 视图ID过滤
|
|
1868
|
-
* @param filterDes 描述过滤
|
|
1869
|
-
* @returns 节点数组
|
|
575
|
+
static paste(node: Node, text: string): boolean;
|
|
576
|
+
static focus(node: Node): boolean;
|
|
577
|
+
/**
|
|
578
|
+
* 选择文本
|
|
579
|
+
* @param node 目标节点
|
|
580
|
+
* @param selectionStart 选择起始位置
|
|
581
|
+
* @param selectionEnd 选择结束位置
|
|
582
|
+
* @returns 是否成功
|
|
1870
583
|
*/
|
|
1871
|
-
|
|
1872
|
-
filterText?: string;
|
|
1873
|
-
filterViewId?: string;
|
|
1874
|
-
filterDes?: string;
|
|
1875
|
-
}): Node[];
|
|
584
|
+
static selectionText(node: Node, selectionStart: number, selectionEnd: number): boolean;
|
|
1876
585
|
/**
|
|
1877
|
-
*
|
|
1878
|
-
* @param
|
|
1879
|
-
* @returns
|
|
586
|
+
* 向前滚动
|
|
587
|
+
* @param node 可滚动节点
|
|
588
|
+
* @returns 是否成功
|
|
1880
589
|
*/
|
|
1881
|
-
|
|
590
|
+
static scrollForward(node: Node): boolean;
|
|
1882
591
|
/**
|
|
1883
|
-
*
|
|
1884
|
-
* @param
|
|
1885
|
-
* @returns
|
|
592
|
+
* 向后滚动
|
|
593
|
+
* @param node 可滚动节点
|
|
594
|
+
* @returns 是否成功
|
|
1886
595
|
*/
|
|
1887
|
-
|
|
596
|
+
static scrollBackward(node: Node): boolean;
|
|
1888
597
|
/**
|
|
1889
|
-
*
|
|
1890
|
-
* @
|
|
598
|
+
* 对节点执行点击手势
|
|
599
|
+
* @param node 目标节点
|
|
600
|
+
* @param offsetX X轴偏移
|
|
601
|
+
* @param offsetY Y轴偏移
|
|
602
|
+
* @param switchWindowIntervalDelay 窗口切换延迟
|
|
603
|
+
* @param clickDuration 点击持续时间
|
|
604
|
+
* @param timeout 超时时间(秒),默认30秒
|
|
605
|
+
* @returns 是否成功
|
|
1891
606
|
*/
|
|
1892
|
-
|
|
607
|
+
static clickNodeByGesture(node: Node, { offsetX, offsetY, switchWindowIntervalDelay, clickDuration, timeout, }?: {
|
|
608
|
+
offsetX?: number;
|
|
609
|
+
offsetY?: number;
|
|
610
|
+
switchWindowIntervalDelay?: number;
|
|
611
|
+
clickDuration?: number;
|
|
612
|
+
timeout?: number;
|
|
613
|
+
}): Promise<boolean>;
|
|
1893
614
|
/**
|
|
1894
|
-
*
|
|
1895
|
-
* @param
|
|
1896
|
-
* @param
|
|
1897
|
-
* @param
|
|
615
|
+
* 对节点执行双击手势
|
|
616
|
+
* @param node 目标节点
|
|
617
|
+
* @param offsetX X轴偏移
|
|
618
|
+
* @param offsetY Y轴偏移
|
|
619
|
+
* @param switchWindowIntervalDelay 窗口切换延迟
|
|
620
|
+
* @param clickDuration 点击持续时间
|
|
621
|
+
* @param clickInterval 点击间隔
|
|
622
|
+
* @param timeout 超时时间(秒),默认30秒
|
|
1898
623
|
* @returns 是否成功
|
|
1899
624
|
*/
|
|
1900
|
-
|
|
1901
|
-
|
|
625
|
+
static doubleClickNodeByGesture(node: Node, { offsetX, offsetY, switchWindowIntervalDelay, clickDuration, clickInterval, timeout, }?: {
|
|
626
|
+
offsetX?: number;
|
|
627
|
+
offsetY?: number;
|
|
628
|
+
switchWindowIntervalDelay?: number;
|
|
629
|
+
clickDuration?: number;
|
|
630
|
+
clickInterval?: number;
|
|
631
|
+
timeout?: number;
|
|
632
|
+
}): Promise<boolean>;
|
|
633
|
+
/**
|
|
634
|
+
* 执行线型手势
|
|
635
|
+
* @param startPoint
|
|
636
|
+
* @param endPoint
|
|
637
|
+
* @param param2
|
|
638
|
+
* @param timeout 超时时间(秒),默认30秒
|
|
639
|
+
* @returns
|
|
640
|
+
*/
|
|
641
|
+
static performLinearGesture(startPoint: {
|
|
642
|
+
x: number;
|
|
643
|
+
y: number;
|
|
644
|
+
}, endPoint: {
|
|
1902
645
|
x: number;
|
|
1903
646
|
y: number;
|
|
1904
|
-
},
|
|
647
|
+
}, { duration, timeout }?: {
|
|
648
|
+
duration?: number;
|
|
649
|
+
timeout?: number;
|
|
650
|
+
}): Promise<boolean>;
|
|
651
|
+
static longPressNodeByGestureAutoPaste(node: Node, text: string, { matchedPackageName, matchedText, timeoutMillis, longPressDuration, timeout, }?: {
|
|
1905
652
|
matchedPackageName?: string;
|
|
1906
653
|
matchedText?: string;
|
|
1907
654
|
timeoutMillis?: number;
|
|
1908
655
|
longPressDuration?: number;
|
|
656
|
+
timeout?: number;
|
|
1909
657
|
}): Promise<boolean>;
|
|
1910
|
-
|
|
1911
|
-
performLinearGesture(startPoint: {
|
|
1912
|
-
x: number;
|
|
1913
|
-
y: number;
|
|
1914
|
-
}, endPoint: {
|
|
658
|
+
static longPressGestureAutoPaste(point: {
|
|
1915
659
|
x: number;
|
|
1916
660
|
y: number;
|
|
1917
|
-
}, {
|
|
1918
|
-
|
|
661
|
+
}, text: string, { matchedPackageName, matchedText, timeoutMillis, longPressDuration, timeout, }?: {
|
|
662
|
+
matchedPackageName?: string;
|
|
663
|
+
matchedText?: string;
|
|
664
|
+
timeoutMillis?: number;
|
|
665
|
+
longPressDuration?: number;
|
|
666
|
+
timeout?: number;
|
|
1919
667
|
}): Promise<boolean>;
|
|
668
|
+
static getAppInfo(packageName: string, timeout?: number): Promise<AppInfo>;
|
|
669
|
+
static getUniqueDeviceId(): any;
|
|
670
|
+
static getAndroidID(): any;
|
|
671
|
+
static getMacAddress(timeout?: number): Promise<any>;
|
|
672
|
+
static getDeviceInfo(timeout?: number): Promise<DeviceInfo>;
|
|
673
|
+
static getNetworkType(timeout?: number): Promise<any>;
|
|
1920
674
|
/**
|
|
1921
|
-
*
|
|
1922
|
-
* @
|
|
675
|
+
* 播放系统电话铃声
|
|
676
|
+
* @param timeout 超时时间(秒),默认30秒
|
|
677
|
+
* @returns 播放结果消息
|
|
1923
678
|
*/
|
|
1924
|
-
|
|
679
|
+
static audioPlayRingtone(timeout?: number): Promise<string>;
|
|
1925
680
|
/**
|
|
1926
|
-
*
|
|
1927
|
-
* @
|
|
681
|
+
* 停止播放系统电话铃声
|
|
682
|
+
* @param timeout 超时时间(秒),默认30秒
|
|
683
|
+
* @returns 停止结果消息
|
|
1928
684
|
*/
|
|
1929
|
-
|
|
685
|
+
static audioStopRingtone(timeout?: number): Promise<string>;
|
|
686
|
+
static setAccessibilityEventFilters(value: AccessibilityEventFilter[]): Promise<any>;
|
|
687
|
+
static addAccessibilityEventFilter(value: AccessibilityEventFilter): Promise<any>;
|
|
1930
688
|
/**
|
|
1931
|
-
*
|
|
1932
|
-
* @returns
|
|
689
|
+
* 获取屏幕尺寸
|
|
690
|
+
* @returns 屏幕尺寸对象(width, height)
|
|
1933
691
|
*/
|
|
1934
|
-
|
|
692
|
+
static getScreenSize(): Screen | null;
|
|
1935
693
|
/**
|
|
1936
|
-
*
|
|
1937
|
-
* @returns
|
|
694
|
+
* 获取应用窗口尺寸
|
|
695
|
+
* @returns 应用窗口尺寸对象
|
|
1938
696
|
*/
|
|
1939
|
-
|
|
697
|
+
static getAppScreenSize(): any;
|
|
1940
698
|
/**
|
|
1941
|
-
*
|
|
1942
|
-
* @
|
|
699
|
+
* 添加无障碍事件监听器
|
|
700
|
+
* @param listener 监听器函数
|
|
1943
701
|
*/
|
|
1944
|
-
|
|
702
|
+
static addAccessibilityEventListener(listener: AccessibilityEventListener): void;
|
|
1945
703
|
/**
|
|
1946
|
-
*
|
|
1947
|
-
* @
|
|
704
|
+
* 判断是否包含无障碍事件监听器
|
|
705
|
+
* @param listener 监听器函数
|
|
706
|
+
* @returns 是否包含
|
|
707
|
+
*/
|
|
708
|
+
static containsAccessibilityEventListener(listener: AccessibilityEventListener): boolean;
|
|
709
|
+
/**
|
|
710
|
+
* 移除无障碍事件监听器
|
|
711
|
+
* @param listener 要移除的监听器函数
|
|
712
|
+
* @returns 是否移除成功
|
|
713
|
+
*/
|
|
714
|
+
static removeAccessibilityEventListener(listener: AccessibilityEventListener): boolean;
|
|
715
|
+
/**
|
|
716
|
+
* 移除所有无障碍事件监听器
|
|
717
|
+
*/
|
|
718
|
+
static removeAllAccessibilityEventListeners(): void;
|
|
719
|
+
/**
|
|
720
|
+
* 获取当前注册的无障碍事件监听器数量
|
|
721
|
+
* @returns 监听器数量
|
|
1948
722
|
*/
|
|
1949
|
-
|
|
723
|
+
static getAccessibilityEventListenerCount(): number;
|
|
1950
724
|
}
|
|
1951
725
|
|
|
726
|
+
declare const CallMethod: {
|
|
727
|
+
readonly takeScreenshot: "takeScreenshot";
|
|
728
|
+
readonly takeScreenshotSave: "takeScreenshotSave";
|
|
729
|
+
readonly takeScreenshotToFile: "takeScreenshotToFile";
|
|
730
|
+
readonly overlayToast: "overlayToast";
|
|
731
|
+
readonly setNodeText: "setNodeText";
|
|
732
|
+
readonly findByTags: "findByTags";
|
|
733
|
+
readonly findById: "findById";
|
|
734
|
+
readonly findByText: "findByText";
|
|
735
|
+
readonly findByTextAllMatch: "findByTextAllMatch";
|
|
736
|
+
readonly containsText: "containsText";
|
|
737
|
+
readonly getAllText: "getAllText";
|
|
738
|
+
readonly findFirstParentByTags: "findFirstParentByTags";
|
|
739
|
+
readonly getAllNodes: "getAllNodes";
|
|
740
|
+
readonly getNodes: "getNodes";
|
|
741
|
+
readonly findFirstParentClickable: "findFirstParentClickable";
|
|
742
|
+
readonly getChildren: "getChildren";
|
|
743
|
+
readonly getBoundsInScreen: "getBoundsInScreen";
|
|
744
|
+
readonly isVisible: "isVisible";
|
|
745
|
+
readonly click: "click";
|
|
746
|
+
readonly longClick: "longClick";
|
|
747
|
+
readonly back: "back";
|
|
748
|
+
readonly home: "home";
|
|
749
|
+
readonly notifications: "notifications";
|
|
750
|
+
readonly recentApps: "recentApps";
|
|
751
|
+
readonly paste: "paste";
|
|
752
|
+
readonly focus: "focus";
|
|
753
|
+
readonly selectionText: "selectionText";
|
|
754
|
+
readonly scrollForward: "scrollForward";
|
|
755
|
+
readonly launchApp: "launchApp";
|
|
756
|
+
readonly getPackageName: "getPackageName";
|
|
757
|
+
readonly getScreenSize: "getScreenSize";
|
|
758
|
+
readonly getAppScreenSize: "getAppScreenSize";
|
|
759
|
+
readonly scrollBackward: "scrollBackward";
|
|
760
|
+
readonly setOverlayFlags: "setOverlayFlags";
|
|
761
|
+
readonly scanQR: "scanQR";
|
|
762
|
+
readonly loadWebViewOverlay: "loadWebViewOverlay";
|
|
763
|
+
readonly closeOverlay: "closeOverlay";
|
|
764
|
+
readonly recognizeTextInScreenshot: "recognizeTextInScreenshot";
|
|
765
|
+
readonly clickByGesture: "clickByGesture";
|
|
766
|
+
readonly clickNodeByGesture: "clickNodeByGesture";
|
|
767
|
+
readonly doubleClickNodeByGesture: "doubleClickNodeByGesture";
|
|
768
|
+
readonly performLinearGesture: "performLinearGesture";
|
|
769
|
+
readonly longPressGestureAutoPaste: "longPressGestureAutoPaste";
|
|
770
|
+
readonly getAppInfo: "getAppInfo";
|
|
771
|
+
readonly getMacAddress: "getMacAddress";
|
|
772
|
+
readonly getAndroidID: "getAndroidID";
|
|
773
|
+
readonly getUniqueDeviceId: "getUniqueDeviceId";
|
|
774
|
+
readonly addAccessibilityEventFilter: "addAccessibilityEventFilter";
|
|
775
|
+
readonly setAccessibilityEventFilters: "setAccessibilityEventFilters";
|
|
776
|
+
readonly httpRequest: "httpRequest";
|
|
777
|
+
readonly getDeviceInfo: "getDeviceInfo";
|
|
778
|
+
readonly getNetworkType: "getNetworkType";
|
|
779
|
+
readonly isAppInstalled: "isAppInstalled";
|
|
780
|
+
readonly getClipboardLatestText: "getClipboardLatestText";
|
|
781
|
+
readonly getClipboardText: "getClipboardText";
|
|
782
|
+
readonly openUrlInBrowser: "openUrlInBrowser";
|
|
783
|
+
readonly keepScreenOn: "keepScreenOn";
|
|
784
|
+
readonly clearKeepScreenOn: "clearKeepScreenOn";
|
|
785
|
+
readonly download: "download";
|
|
786
|
+
readonly audioPlayFromFile: "audioPlayFromFile";
|
|
787
|
+
readonly audioStop: "audioStop";
|
|
788
|
+
readonly audioPlayRingtone: "audioPlayRingtone";
|
|
789
|
+
readonly audioStopRingtone: "audioStopRingtone";
|
|
790
|
+
readonly addContact: "addContact";
|
|
791
|
+
readonly getAllContacts: "getAllContacts";
|
|
792
|
+
readonly saveRootNodeTreeJson: "saveRootNodeTreeJson";
|
|
793
|
+
};
|
|
794
|
+
type CallMethodType = (typeof CallMethod)[keyof typeof CallMethod];
|
|
795
|
+
|
|
796
|
+
/**
|
|
797
|
+
* Android 视图类型常量
|
|
798
|
+
*/
|
|
799
|
+
declare const NodeClassValue: {
|
|
800
|
+
readonly ImageView: "android.widget.ImageView";
|
|
801
|
+
readonly TextView: "android.widget.TextView";
|
|
802
|
+
readonly LinearLayout: "android.widget.LinearLayout";
|
|
803
|
+
readonly RelativeLayout: "android.widget.RelativeLayout";
|
|
804
|
+
readonly Button: "android.widget.Button";
|
|
805
|
+
readonly ImageButton: "android.widget.ImageButton";
|
|
806
|
+
readonly EditText: "android.widget.EditText";
|
|
807
|
+
readonly View: "android.view.View";
|
|
808
|
+
readonly ViewGroup: "android.view.ViewGroup";
|
|
809
|
+
readonly FrameLayout: "android.widget.FrameLayout";
|
|
810
|
+
};
|
|
811
|
+
|
|
812
|
+
declare function sleep(ms: number): Promise<void>;
|
|
813
|
+
declare function generateUUID(): string;
|
|
814
|
+
declare function decodeBase64UTF8(base64: string): string;
|
|
815
|
+
|
|
1952
816
|
type StepStatus = 'idle' | 'running' | 'completed' | 'error';
|
|
1953
817
|
interface StepState {
|
|
1954
818
|
status: StepStatus;
|
|
@@ -1964,6 +828,8 @@ declare const useStepStore: pinia.StoreDefinition<"step", StepState, {}, {
|
|
|
1964
828
|
reset(): void;
|
|
1965
829
|
}>;
|
|
1966
830
|
|
|
831
|
+
declare function ensureAssistsXPinia(): void;
|
|
832
|
+
|
|
1967
833
|
/**
|
|
1968
834
|
* 窗口标志位常量类
|
|
1969
835
|
* 定义了各种窗口行为和属性的标志位
|
|
@@ -2118,12 +984,13 @@ declare class AssistsXAsync {
|
|
|
2118
984
|
* @param timeout 超时时间(秒),默认30秒
|
|
2119
985
|
* @returns 节点数组
|
|
2120
986
|
*/
|
|
2121
|
-
static getAllNodes({ filterClass, filterViewId, filterDes, filterText, timeout, }?: {
|
|
987
|
+
static getAllNodes({ filterClass, filterViewId, filterDes, filterText, timeout, scope, }?: {
|
|
2122
988
|
filterClass?: string;
|
|
2123
989
|
filterViewId?: string;
|
|
2124
990
|
filterDes?: string;
|
|
2125
991
|
filterText?: string;
|
|
2126
992
|
timeout?: number;
|
|
993
|
+
scope?: NodeLookupScope;
|
|
2127
994
|
}): Promise<Node[]>;
|
|
2128
995
|
/**
|
|
2129
996
|
* 设置节点文本
|
|
@@ -2219,9 +1086,17 @@ declare class AssistsXAsync {
|
|
|
2219
1086
|
/**
|
|
2220
1087
|
* 获取当前应用包名
|
|
2221
1088
|
* @param timeout 超时时间(秒),默认30秒
|
|
2222
|
-
* @returns 包名
|
|
2223
1089
|
*/
|
|
2224
1090
|
static getPackageName(timeout?: number): Promise<string>;
|
|
1091
|
+
/**
|
|
1092
|
+
* 获取当前应用包名
|
|
1093
|
+
* @param options.timeout 超时时间(秒),默认30秒
|
|
1094
|
+
* @param options.scope 节点查找范围(可选)
|
|
1095
|
+
*/
|
|
1096
|
+
static getPackageName(options: {
|
|
1097
|
+
timeout?: number;
|
|
1098
|
+
scope?: NodeLookupScope;
|
|
1099
|
+
}): Promise<string>;
|
|
2225
1100
|
/**
|
|
2226
1101
|
* 显示悬浮提示
|
|
2227
1102
|
* @param text 提示文本
|
|
@@ -2240,12 +1115,13 @@ declare class AssistsXAsync {
|
|
|
2240
1115
|
* @param timeout 超时时间(秒),默认30秒
|
|
2241
1116
|
* @returns 节点数组
|
|
2242
1117
|
*/
|
|
2243
|
-
static findById(id: string, { filterClass, filterText, filterDes, node, timeout, }?: {
|
|
1118
|
+
static findById(id: string, { filterClass, filterText, filterDes, node, timeout, scope, }?: {
|
|
2244
1119
|
filterClass?: string;
|
|
2245
1120
|
filterText?: string;
|
|
2246
1121
|
filterDes?: string;
|
|
2247
1122
|
node?: Node;
|
|
2248
1123
|
timeout?: number;
|
|
1124
|
+
scope?: NodeLookupScope;
|
|
2249
1125
|
}): Promise<Node[]>;
|
|
2250
1126
|
/**
|
|
2251
1127
|
* 通过文本查找节点
|
|
@@ -2257,12 +1133,13 @@ declare class AssistsXAsync {
|
|
|
2257
1133
|
* @param timeout 超时时间(秒),默认30秒
|
|
2258
1134
|
* @returns 节点数组
|
|
2259
1135
|
*/
|
|
2260
|
-
static findByText(text: string, { filterClass, filterViewId, filterDes, node, timeout, }?: {
|
|
1136
|
+
static findByText(text: string, { filterClass, filterViewId, filterDes, node, timeout, scope, }?: {
|
|
2261
1137
|
filterClass?: string;
|
|
2262
1138
|
filterViewId?: string;
|
|
2263
1139
|
filterDes?: string;
|
|
2264
1140
|
node?: Node;
|
|
2265
1141
|
timeout?: number;
|
|
1142
|
+
scope?: NodeLookupScope;
|
|
2266
1143
|
}): Promise<Node[]>;
|
|
2267
1144
|
/**
|
|
2268
1145
|
* 通过标签查找节点
|
|
@@ -2274,20 +1151,30 @@ declare class AssistsXAsync {
|
|
|
2274
1151
|
* @param timeout 超时时间(秒),默认30秒
|
|
2275
1152
|
* @returns 节点数组
|
|
2276
1153
|
*/
|
|
2277
|
-
static findByTags(className: string, { filterText, filterViewId, filterDes, node, timeout, }?: {
|
|
1154
|
+
static findByTags(className: string, { filterText, filterViewId, filterDes, node, timeout, scope, }?: {
|
|
2278
1155
|
filterText?: string;
|
|
2279
1156
|
filterViewId?: string;
|
|
2280
1157
|
filterDes?: string;
|
|
2281
1158
|
node?: Node;
|
|
2282
1159
|
timeout?: number;
|
|
1160
|
+
scope?: NodeLookupScope;
|
|
2283
1161
|
}): Promise<Node[]>;
|
|
2284
1162
|
/**
|
|
2285
1163
|
* 查找所有匹配文本的节点
|
|
2286
1164
|
* @param text 要查找的文本
|
|
2287
1165
|
* @param timeout 超时时间(秒),默认30秒
|
|
2288
|
-
* @returns 节点数组
|
|
2289
1166
|
*/
|
|
2290
1167
|
static findByTextAllMatch(text: string, timeout?: number): Promise<Node[]>;
|
|
1168
|
+
/**
|
|
1169
|
+
* 查找所有匹配文本的节点
|
|
1170
|
+
* @param text 要查找的文本
|
|
1171
|
+
* @param options.timeout 超时时间(秒),默认30秒
|
|
1172
|
+
* @param options.scope 节点查找范围(可选)
|
|
1173
|
+
*/
|
|
1174
|
+
static findByTextAllMatch(text: string, options: {
|
|
1175
|
+
timeout?: number;
|
|
1176
|
+
scope?: NodeLookupScope;
|
|
1177
|
+
}): Promise<Node[]>;
|
|
2291
1178
|
/**
|
|
2292
1179
|
* 检查是否包含指定文本
|
|
2293
1180
|
* @param text 要检查的文本
|
|
@@ -2554,12 +1441,14 @@ declare class AssistsXAsync {
|
|
|
2554
1441
|
* @param options.filePath 文件路径(可选,不提供则自动生成)
|
|
2555
1442
|
* @param options.prettyPrint 是否格式化输出,默认为 true
|
|
2556
1443
|
* @param options.timeout 超时时间(秒),默认30秒
|
|
1444
|
+
* @param options.scope 节点查找范围(可选)
|
|
2557
1445
|
* @returns 保存的文件路径
|
|
2558
1446
|
*/
|
|
2559
1447
|
static saveRootNodeTreeJson(options?: {
|
|
2560
1448
|
filePath?: string;
|
|
2561
1449
|
prettyPrint?: boolean;
|
|
2562
1450
|
timeout?: number;
|
|
1451
|
+
scope?: NodeLookupScope;
|
|
2563
1452
|
}): Promise<string>;
|
|
2564
1453
|
/**
|
|
2565
1454
|
* 获取剪贴板文本内容
|
|
@@ -4198,6 +3087,16 @@ declare class Log {
|
|
|
4198
3087
|
appendLine(line: string, maxLength?: number, timeout?: number): Promise<boolean>;
|
|
4199
3088
|
/** 追加带时间戳的条目 */
|
|
4200
3089
|
appendTimestampedEntry(message: string, timeout?: number): Promise<boolean>;
|
|
3090
|
+
/**
|
|
3091
|
+
* 追加日志(appendTimestampedEntry / appendLine 简写)。
|
|
3092
|
+
* 默认带时间戳;`timestamped: false` 时走 appendLine。
|
|
3093
|
+
*/
|
|
3094
|
+
append(text: string, options?: {
|
|
3095
|
+
/** @default true */
|
|
3096
|
+
timestamped?: boolean;
|
|
3097
|
+
maxLength?: number;
|
|
3098
|
+
timeout?: number;
|
|
3099
|
+
}): Promise<boolean>;
|
|
4201
3100
|
/** 替换全部内容 */
|
|
4202
3101
|
replaceAll(content: string, timeout?: number): Promise<boolean>;
|
|
4203
3102
|
/**
|
|
@@ -4228,4 +3127,4 @@ declare class Log {
|
|
|
4228
3127
|
/** 默认单例,用法与 floatingwindow 模块导出的 float 一致 */
|
|
4229
3128
|
declare const log: Log;
|
|
4230
3129
|
|
|
4231
|
-
export { type AccessibilityEvent, type AccessibilityEventData, AccessibilityEventFilter, type AccessibilityEventFilterConfig, type AccessibilityEventListener, AppInfo, AssistsX, AssistsXAsync, BarUtils, BarUtilsCallMethod, type BarUtilsCallMethodType, Bounds, CallMethod, type CallMethodType, CallResponse, type Contact, DeviceInfo, FileIO, type FileInfo, type FileListItem, type FileUploadInfo, FileUtils, Float, FloatCallMethod, type FloatCallMethodType, Gallery, type GalleryDeleteResponse, type GalleryResponse, Http, type HttpConfig, type HttpDownloadResponse, type HttpResponse, type ImageProcessResult, type ImageRotateDegree, type ImageSaveResult, type ImageSize, type ImageType, ImageUtils, Ime, ImeAction, type IsCurrentInputMethodResponse, type IsInputMethodEnabledResponse, Log, LogCallMethod, type LogCallMethodType, LogStream, type LogStreamType, type LogSubscribeUpdatePayload, type LogUpdateData, type LogUpdateEvent, type LogUploadOptions, type LogUploadResult, Mlkit, MlkitCallMethod, type MlkitCallMethodType, type MlkitRegion, Node,
|
|
3130
|
+
export { type AccessibilityEvent, type AccessibilityEventData, AccessibilityEventFilter, type AccessibilityEventFilterConfig, type AccessibilityEventListener, AppInfo, AssistsX, AssistsXAsync, BarUtils, BarUtilsCallMethod, type BarUtilsCallMethodType, Bounds, CallMethod, type CallMethodType, CallResponse, type Contact, DeviceInfo, FileIO, type FileInfo, type FileListItem, type FileUploadInfo, FileUtils, Float, FloatCallMethod, type FloatCallMethodType, Gallery, type GalleryDeleteResponse, type GalleryResponse, Http, type HttpConfig, type HttpDownloadResponse, type HttpResponse, type ImageProcessResult, type ImageRotateDegree, type ImageSaveResult, type ImageSize, type ImageType, ImageUtils, Ime, ImeAction, type IsCurrentInputMethodResponse, type IsInputMethodEnabledResponse, Log, LogCallMethod, type LogCallMethodType, LogStream, type LogStreamType, type LogSubscribeUpdatePayload, type LogUpdateData, type LogUpdateEvent, type LogUploadOptions, type LogUploadResult, Mlkit, MlkitCallMethod, type MlkitCallMethodType, type MlkitRegion, Node, NodeClassValue, NodeLookupScope, type OpenInputMethodSettingsResponse, Path, type PerformEditorActionResponse, type RecognizeTextInScreenshotPosition, type RecognizeTextInScreenshotResult, type RecognizeTextRegion, type Screen, type ScreenTextJsonResult, type ScreenTextRecognitionResult, type StepState, type StepStatus, type TextPosition, type WebFloatingWindowOptions, WindowFlags, accessibilityEventListeners, barUtils, callbacks, decodeBase64UTF8, ensureAssistsXPinia, fileIO, fileUtils, float, gallery, generateUUID, http, imageUtils, ime, log, logUpdateListeners, mlkit, pathUtils, screen, sleep, useStepStore };
|