assistsx-js 0.0.1352 → 0.0.2001
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/dist/AssistsX.d.ts +28 -15
- package/dist/AssistsX.js +135 -47
- package/dist/AssistsXAsync.d.ts +324 -0
- package/dist/AssistsXAsync.js +531 -0
- package/dist/CallMethod.d.ts +2 -0
- package/dist/CallMethod.js +2 -0
- package/dist/Node.d.ts +11 -8
- package/dist/Node.js +64 -20
- package/dist/NodeAsync.d.ts +194 -0
- package/dist/NodeAsync.js +297 -0
- package/dist/Step.d.ts +32 -12
- package/dist/Step.js +79 -33
- package/dist/StepAsync.d.ts +168 -0
- package/dist/StepAsync.js +275 -0
- package/dist/StepError.d.ts +27 -0
- package/dist/StepError.js +15 -0
- package/dist/index.d.ts +13 -10
- package/dist/index.js +13 -10
- package/package.json +2 -2
- package/src/AssistsX.ts +808 -585
- package/src/AssistsXAsync.ts +719 -0
- package/src/CallMethod.ts +3 -1
- package/src/Node.ts +428 -323
- package/src/NodeAsync.ts +398 -0
- package/src/Step.ts +680 -491
- package/src/StepAsync.ts +377 -0
- package/src/StepError.ts +47 -0
- package/src/global.d.ts +12 -9
- package/src/index.ts +13 -10
|
@@ -0,0 +1,324 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AssistsX 类
|
|
3
|
+
* 提供与移动应用程序界面交互的工具类,包括节点查找、手势操作、屏幕操作等功能
|
|
4
|
+
*/
|
|
5
|
+
import { Node } from "./Node";
|
|
6
|
+
import { Bounds } from "./Bounds";
|
|
7
|
+
import { WebFloatingWindowOptions } from "./AssistsX";
|
|
8
|
+
export declare class AssistsXAsync {
|
|
9
|
+
/**
|
|
10
|
+
* 执行异步调用
|
|
11
|
+
* @param method 方法名
|
|
12
|
+
* @param args 参数对象
|
|
13
|
+
* @returns Promise<调用响应>
|
|
14
|
+
*/
|
|
15
|
+
private static asyncCall;
|
|
16
|
+
/**
|
|
17
|
+
* 设置悬浮窗标志
|
|
18
|
+
* @param flags 标志
|
|
19
|
+
* @returns 是否设置成功
|
|
20
|
+
*/
|
|
21
|
+
static setOverlayFlags(flags: number): Promise<boolean>;
|
|
22
|
+
/**
|
|
23
|
+
* 设置悬浮窗标志
|
|
24
|
+
* @param flags 标志
|
|
25
|
+
* @returns 是否设置成功
|
|
26
|
+
*/
|
|
27
|
+
static setOverlayFlagList(flags: number[]): Promise<boolean>;
|
|
28
|
+
/**
|
|
29
|
+
* 获取所有符合条件的节点
|
|
30
|
+
* @param filterClass 类名过滤
|
|
31
|
+
* @param filterViewId 视图ID过滤
|
|
32
|
+
* @param filterDes 描述过滤
|
|
33
|
+
* @param filterText 文本过滤
|
|
34
|
+
* @returns 节点数组
|
|
35
|
+
*/
|
|
36
|
+
static getAllNodes({ filterClass, filterViewId, filterDes, filterText, }?: {
|
|
37
|
+
filterClass?: string;
|
|
38
|
+
filterViewId?: string;
|
|
39
|
+
filterDes?: string;
|
|
40
|
+
filterText?: string;
|
|
41
|
+
}): Promise<Node[]>;
|
|
42
|
+
/**
|
|
43
|
+
* 设置节点文本
|
|
44
|
+
* @param node 目标节点
|
|
45
|
+
* @param text 要设置的文本
|
|
46
|
+
* @returns 是否设置成功
|
|
47
|
+
*/
|
|
48
|
+
static setNodeText(node: Node, text: string): Promise<boolean>;
|
|
49
|
+
/**
|
|
50
|
+
* 对指定节点进行截图
|
|
51
|
+
* @param nodes 要截图的节点数组
|
|
52
|
+
* @param overlayHiddenScreenshotDelayMillis 截图延迟时间(毫秒)
|
|
53
|
+
* @returns 截图路径数组
|
|
54
|
+
*/
|
|
55
|
+
static takeScreenshotNodes(nodes: Node[], overlayHiddenScreenshotDelayMillis?: number): Promise<string[]>;
|
|
56
|
+
static scanQR(): Promise<string>;
|
|
57
|
+
static loadWebViewOverlay(url: string, options?: WebFloatingWindowOptions): Promise<any>;
|
|
58
|
+
/**
|
|
59
|
+
* 点击节点
|
|
60
|
+
* @param node 要点击的节点
|
|
61
|
+
* @returns 是否点击成功
|
|
62
|
+
*/
|
|
63
|
+
static click(node: Node): Promise<boolean>;
|
|
64
|
+
/**
|
|
65
|
+
* 长按节点
|
|
66
|
+
* @param node 要长按的节点
|
|
67
|
+
* @returns 是否长按成功
|
|
68
|
+
*/
|
|
69
|
+
static longClick(node: Node): Promise<boolean>;
|
|
70
|
+
/**
|
|
71
|
+
* 启动应用
|
|
72
|
+
* @param packageName 应用包名
|
|
73
|
+
* @returns 是否启动成功
|
|
74
|
+
*/
|
|
75
|
+
static launchApp(packageName: string): Promise<boolean>;
|
|
76
|
+
/**
|
|
77
|
+
* 获取当前应用包名
|
|
78
|
+
* @returns 包名
|
|
79
|
+
*/
|
|
80
|
+
static getPackageName(): Promise<string>;
|
|
81
|
+
/**
|
|
82
|
+
* 显示悬浮提示
|
|
83
|
+
* @param text 提示文本
|
|
84
|
+
* @param delay 显示时长(毫秒)
|
|
85
|
+
* @returns 是否显示成功
|
|
86
|
+
*/
|
|
87
|
+
static overlayToast(text: string, delay?: number): Promise<boolean>;
|
|
88
|
+
/**
|
|
89
|
+
* 通过ID查找节点
|
|
90
|
+
* @param id 节点ID
|
|
91
|
+
* @param filterClass 类名过滤
|
|
92
|
+
* @param filterText 文本过滤
|
|
93
|
+
* @param filterDes 描述过滤
|
|
94
|
+
* @param node 父节点范围
|
|
95
|
+
* @returns 节点数组
|
|
96
|
+
*/
|
|
97
|
+
static findById(id: string, { filterClass, filterText, filterDes, node, }?: {
|
|
98
|
+
filterClass?: string;
|
|
99
|
+
filterText?: string;
|
|
100
|
+
filterDes?: string;
|
|
101
|
+
node?: Node;
|
|
102
|
+
}): Promise<Node[]>;
|
|
103
|
+
/**
|
|
104
|
+
* 通过文本查找节点
|
|
105
|
+
* @param text 要查找的文本
|
|
106
|
+
* @param filterClass 类名过滤
|
|
107
|
+
* @param filterViewId 视图ID过滤
|
|
108
|
+
* @param filterDes 描述过滤
|
|
109
|
+
* @param node 父节点范围
|
|
110
|
+
* @returns 节点数组
|
|
111
|
+
*/
|
|
112
|
+
static findByText(text: string, { filterClass, filterViewId, filterDes, node, }?: {
|
|
113
|
+
filterClass?: string;
|
|
114
|
+
filterViewId?: string;
|
|
115
|
+
filterDes?: string;
|
|
116
|
+
node?: Node;
|
|
117
|
+
}): Promise<Node[]>;
|
|
118
|
+
/**
|
|
119
|
+
* 通过标签查找节点
|
|
120
|
+
* @param className 类名
|
|
121
|
+
* @param filterText 文本过滤
|
|
122
|
+
* @param filterViewId 视图ID过滤
|
|
123
|
+
* @param filterDes 描述过滤
|
|
124
|
+
* @param node 父节点范围
|
|
125
|
+
* @returns 节点数组
|
|
126
|
+
*/
|
|
127
|
+
static findByTags(className: string, { filterText, filterViewId, filterDes, node, }?: {
|
|
128
|
+
filterText?: string;
|
|
129
|
+
filterViewId?: string;
|
|
130
|
+
filterDes?: string;
|
|
131
|
+
node?: Node;
|
|
132
|
+
}): Promise<Node[]>;
|
|
133
|
+
/**
|
|
134
|
+
* 查找所有匹配文本的节点
|
|
135
|
+
* @param text 要查找的文本
|
|
136
|
+
* @returns 节点数组
|
|
137
|
+
*/
|
|
138
|
+
static findByTextAllMatch(text: string): Promise<Node[]>;
|
|
139
|
+
/**
|
|
140
|
+
* 检查是否包含指定文本
|
|
141
|
+
* @param text 要检查的文本
|
|
142
|
+
* @returns 是否包含
|
|
143
|
+
*/
|
|
144
|
+
static containsText(text: string): Promise<boolean>;
|
|
145
|
+
/**
|
|
146
|
+
* 获取所有文本
|
|
147
|
+
* @returns 文本数组
|
|
148
|
+
*/
|
|
149
|
+
static getAllText(): Promise<string[]>;
|
|
150
|
+
/**
|
|
151
|
+
* 查找第一个匹配标签的父节点
|
|
152
|
+
* @param className 类名
|
|
153
|
+
* @returns 父节点
|
|
154
|
+
*/
|
|
155
|
+
static findFirstParentByTags(className: string): Promise<Node>;
|
|
156
|
+
/**
|
|
157
|
+
* 获取节点的所有子节点
|
|
158
|
+
* @param node 父节点
|
|
159
|
+
* @returns 子节点数组
|
|
160
|
+
*/
|
|
161
|
+
static getNodes(node: Node): Promise<Node[]>;
|
|
162
|
+
/**
|
|
163
|
+
* 获取节点的直接子节点
|
|
164
|
+
* @param node 父节点
|
|
165
|
+
* @returns 子节点数组
|
|
166
|
+
*/
|
|
167
|
+
static getChildren(node: Node): Promise<Node[]>;
|
|
168
|
+
/**
|
|
169
|
+
* 查找第一个可点击的父节点
|
|
170
|
+
* @param node 起始节点
|
|
171
|
+
* @returns 可点击的父节点
|
|
172
|
+
*/
|
|
173
|
+
static findFirstParentClickable(node: Node): Promise<Node>;
|
|
174
|
+
/**
|
|
175
|
+
* 获取节点在屏幕中的边界
|
|
176
|
+
* @param node 目标节点
|
|
177
|
+
* @returns 边界对象
|
|
178
|
+
*/
|
|
179
|
+
static getBoundsInScreen(node: Node): Promise<Bounds>;
|
|
180
|
+
/**
|
|
181
|
+
* 检查节点是否可见
|
|
182
|
+
* @param node 目标节点
|
|
183
|
+
* @param compareNode 比较节点
|
|
184
|
+
* @param isFullyByCompareNode 是否完全可见
|
|
185
|
+
* @returns 是否可见
|
|
186
|
+
*/
|
|
187
|
+
static isVisible(node: Node, { compareNode, isFullyByCompareNode, }?: {
|
|
188
|
+
compareNode?: Node;
|
|
189
|
+
isFullyByCompareNode?: boolean;
|
|
190
|
+
}): Promise<boolean>;
|
|
191
|
+
/**
|
|
192
|
+
* 执行点击手势
|
|
193
|
+
* @param x 横坐标
|
|
194
|
+
* @param y 纵坐标
|
|
195
|
+
* @param duration 持续时间
|
|
196
|
+
* @returns 是否成功
|
|
197
|
+
*/
|
|
198
|
+
static clickByGesture(x: number, y: number, duration: number): Promise<boolean>;
|
|
199
|
+
/**
|
|
200
|
+
* 返回操作
|
|
201
|
+
* @returns 是否成功
|
|
202
|
+
*/
|
|
203
|
+
static back(): Promise<boolean>;
|
|
204
|
+
/**
|
|
205
|
+
* 回到主页
|
|
206
|
+
* @returns 是否成功
|
|
207
|
+
*/
|
|
208
|
+
static home(): Promise<boolean>;
|
|
209
|
+
/**
|
|
210
|
+
* 打开通知栏
|
|
211
|
+
* @returns 是否成功
|
|
212
|
+
*/
|
|
213
|
+
static notifications(): Promise<boolean>;
|
|
214
|
+
/**
|
|
215
|
+
* 显示最近应用
|
|
216
|
+
* @returns 是否成功
|
|
217
|
+
*/
|
|
218
|
+
static recentApps(): Promise<boolean>;
|
|
219
|
+
/**
|
|
220
|
+
* 在节点中粘贴文本
|
|
221
|
+
* @param node 目标节点
|
|
222
|
+
* @param text 要粘贴的文本
|
|
223
|
+
* @returns 是否成功
|
|
224
|
+
*/
|
|
225
|
+
static paste(node: Node, text: string): Promise<boolean>;
|
|
226
|
+
static focus(node: Node): Promise<boolean>;
|
|
227
|
+
/**
|
|
228
|
+
* 选择文本
|
|
229
|
+
* @param node 目标节点
|
|
230
|
+
* @param selectionStart 选择起始位置
|
|
231
|
+
* @param selectionEnd 选择结束位置
|
|
232
|
+
* @returns 是否成功
|
|
233
|
+
*/
|
|
234
|
+
static selectionText(node: Node, selectionStart: number, selectionEnd: number): Promise<boolean>;
|
|
235
|
+
/**
|
|
236
|
+
* 向前滚动
|
|
237
|
+
* @param node 可滚动节点
|
|
238
|
+
* @returns 是否成功
|
|
239
|
+
*/
|
|
240
|
+
static scrollForward(node: Node): Promise<boolean>;
|
|
241
|
+
/**
|
|
242
|
+
* 向后滚动
|
|
243
|
+
* @param node 可滚动节点
|
|
244
|
+
* @returns 是否成功
|
|
245
|
+
*/
|
|
246
|
+
static scrollBackward(node: Node): Promise<boolean>;
|
|
247
|
+
/**
|
|
248
|
+
* 对节点执行点击手势
|
|
249
|
+
* @param node 目标节点
|
|
250
|
+
* @param offsetX X轴偏移
|
|
251
|
+
* @param offsetY Y轴偏移
|
|
252
|
+
* @param switchWindowIntervalDelay 窗口切换延迟
|
|
253
|
+
* @param clickDuration 点击持续时间
|
|
254
|
+
* @returns 是否成功
|
|
255
|
+
*/
|
|
256
|
+
static clickNodeByGesture(node: Node, { offsetX, offsetY, switchWindowIntervalDelay, clickDuration, }?: {
|
|
257
|
+
offsetX?: number;
|
|
258
|
+
offsetY?: number;
|
|
259
|
+
switchWindowIntervalDelay?: number;
|
|
260
|
+
clickDuration?: number;
|
|
261
|
+
}): Promise<boolean>;
|
|
262
|
+
/**
|
|
263
|
+
* 对节点执行双击手势
|
|
264
|
+
* @param node 目标节点
|
|
265
|
+
* @param offsetX X轴偏移
|
|
266
|
+
* @param offsetY Y轴偏移
|
|
267
|
+
* @param switchWindowIntervalDelay 窗口切换延迟
|
|
268
|
+
* @param clickDuration 点击持续时间
|
|
269
|
+
* @param clickInterval 点击间隔
|
|
270
|
+
* @returns 是否成功
|
|
271
|
+
*/
|
|
272
|
+
static doubleClickNodeByGesture(node: Node, { offsetX, offsetY, switchWindowIntervalDelay, clickDuration, clickInterval, }?: {
|
|
273
|
+
offsetX?: number;
|
|
274
|
+
offsetY?: number;
|
|
275
|
+
switchWindowIntervalDelay?: number;
|
|
276
|
+
clickDuration?: number;
|
|
277
|
+
clickInterval?: number;
|
|
278
|
+
}): Promise<boolean>;
|
|
279
|
+
/**
|
|
280
|
+
* 执行线型手势
|
|
281
|
+
* @param startPoint
|
|
282
|
+
* @param endPoint
|
|
283
|
+
* @param param2
|
|
284
|
+
* @returns
|
|
285
|
+
*/
|
|
286
|
+
static performLinearGesture(startPoint: {
|
|
287
|
+
x: number;
|
|
288
|
+
y: number;
|
|
289
|
+
}, endPoint: {
|
|
290
|
+
x: number;
|
|
291
|
+
y: number;
|
|
292
|
+
}, { duration }?: {
|
|
293
|
+
duration?: number;
|
|
294
|
+
}): Promise<boolean>;
|
|
295
|
+
static longPressNodeByGestureAutoPaste(node: Node, text: string, { matchedPackageName, matchedText, timeoutMillis, longPressDuration, }?: {
|
|
296
|
+
matchedPackageName?: string;
|
|
297
|
+
matchedText?: string;
|
|
298
|
+
timeoutMillis?: number;
|
|
299
|
+
longPressDuration?: number;
|
|
300
|
+
}): Promise<boolean>;
|
|
301
|
+
static longPressGestureAutoPaste(point: {
|
|
302
|
+
x: number;
|
|
303
|
+
y: number;
|
|
304
|
+
}, text: string, { matchedPackageName, matchedText, timeoutMillis, longPressDuration, }?: {
|
|
305
|
+
matchedPackageName?: string;
|
|
306
|
+
matchedText?: string;
|
|
307
|
+
timeoutMillis?: number;
|
|
308
|
+
longPressDuration?: number;
|
|
309
|
+
}): Promise<boolean>;
|
|
310
|
+
static getAppInfo(packageName: string): Promise<any>;
|
|
311
|
+
static getUniqueDeviceId(): Promise<any>;
|
|
312
|
+
static getAndroidID(): Promise<any>;
|
|
313
|
+
static getMacAddress(): Promise<any>;
|
|
314
|
+
/**
|
|
315
|
+
* 获取屏幕尺寸
|
|
316
|
+
* @returns 屏幕尺寸对象
|
|
317
|
+
*/
|
|
318
|
+
static getScreenSize(): Promise<any>;
|
|
319
|
+
/**
|
|
320
|
+
* 获取应用窗口尺寸
|
|
321
|
+
* @returns 应用窗口尺寸对象
|
|
322
|
+
*/
|
|
323
|
+
static getAppScreenSize(): Promise<any>;
|
|
324
|
+
}
|