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