assistsx-js 0.0.1353 → 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.
@@ -0,0 +1,531 @@
1
+ /**
2
+ * AssistsX 类
3
+ * 提供与移动应用程序界面交互的工具类,包括节点查找、手势操作、屏幕操作等功能
4
+ */
5
+ import { Node } from "./Node";
6
+ import { CallMethod } from "./CallMethod";
7
+ import { CallResponse } from "./CallResponse";
8
+ import { Bounds } from "./Bounds";
9
+ import { generateUUID } from "./Utils";
10
+ import { callbacks } from "./AssistsX";
11
+ export class AssistsXAsync {
12
+ /**
13
+ * 执行异步调用
14
+ * @param method 方法名
15
+ * @param args 参数对象
16
+ * @returns Promise<调用响应>
17
+ */
18
+ static async asyncCall(method, { args, node, nodes } = {}) {
19
+ const uuid = generateUUID();
20
+ const params = {
21
+ method,
22
+ arguments: args ? args : undefined,
23
+ node: node ? node : undefined,
24
+ nodes: nodes ? nodes : undefined,
25
+ callbackId: uuid,
26
+ };
27
+ const promise = new Promise((resolve) => {
28
+ callbacks[uuid] = (data) => {
29
+ resolve(data);
30
+ };
31
+ setTimeout(() => {
32
+ resolve(new CallResponse(0, null, uuid));
33
+ }, 10000);
34
+ });
35
+ const result = window.assistsxAsync.call(JSON.stringify(params));
36
+ const promiseResult = await promise;
37
+ if (typeof promiseResult === "string") {
38
+ const responseData = JSON.parse(promiseResult);
39
+ const response = new CallResponse(responseData.code, responseData.data, responseData.callbackId);
40
+ return response;
41
+ }
42
+ throw new Error("Call failed");
43
+ }
44
+ /**
45
+ * 设置悬浮窗标志
46
+ * @param flags 标志
47
+ * @returns 是否设置成功
48
+ */
49
+ static async setOverlayFlags(flags) {
50
+ const response = await this.asyncCall(CallMethod.setOverlayFlags, {
51
+ args: { flags: flags },
52
+ });
53
+ return response.getDataOrDefault(false);
54
+ }
55
+ /**
56
+ * 设置悬浮窗标志
57
+ * @param flags 标志
58
+ * @returns 是否设置成功
59
+ */
60
+ static async setOverlayFlagList(flags) {
61
+ const response = await this.asyncCall(CallMethod.setOverlayFlags, {
62
+ args: { flags: flags },
63
+ });
64
+ return response.getDataOrDefault(false);
65
+ }
66
+ /**
67
+ * 获取所有符合条件的节点
68
+ * @param filterClass 类名过滤
69
+ * @param filterViewId 视图ID过滤
70
+ * @param filterDes 描述过滤
71
+ * @param filterText 文本过滤
72
+ * @returns 节点数组
73
+ */
74
+ static async getAllNodes({ filterClass, filterViewId, filterDes, filterText, } = {}) {
75
+ const response = await this.asyncCall(CallMethod.getAllNodes, {
76
+ args: { filterClass, filterViewId, filterDes, filterText },
77
+ });
78
+ return Node.fromJSONArray(response.getDataOrDefault("[]"));
79
+ }
80
+ /**
81
+ * 设置节点文本
82
+ * @param node 目标节点
83
+ * @param text 要设置的文本
84
+ * @returns 是否设置成功
85
+ */
86
+ static async setNodeText(node, text) {
87
+ const response = await this.asyncCall(CallMethod.setNodeText, {
88
+ args: { text },
89
+ node,
90
+ });
91
+ return response.getDataOrDefault(false);
92
+ }
93
+ /**
94
+ * 对指定节点进行截图
95
+ * @param nodes 要截图的节点数组
96
+ * @param overlayHiddenScreenshotDelayMillis 截图延迟时间(毫秒)
97
+ * @returns 截图路径数组
98
+ */
99
+ static async takeScreenshotNodes(nodes, overlayHiddenScreenshotDelayMillis = 250) {
100
+ const response = await this.asyncCall(CallMethod.takeScreenshot, {
101
+ nodes,
102
+ args: { overlayHiddenScreenshotDelayMillis },
103
+ });
104
+ const data = response.getDataOrDefault("");
105
+ return data.images;
106
+ }
107
+ static async scanQR() {
108
+ const response = await this.asyncCall(CallMethod.scanQR);
109
+ const data = response.getDataOrDefault({ value: "" });
110
+ return data.value;
111
+ }
112
+ static async loadWebViewOverlay(url, options = {}) {
113
+ const { initialWidth, initialHeight, minWidth, minHeight, maxWidth, maxHeight, initialCenter, } = options;
114
+ const response = await this.asyncCall(CallMethod.loadWebViewOverlay, {
115
+ args: {
116
+ url,
117
+ initialWidth,
118
+ initialHeight,
119
+ minWidth,
120
+ minHeight,
121
+ maxWidth,
122
+ maxHeight,
123
+ initialCenter,
124
+ },
125
+ });
126
+ const data = response.getDataOrDefault({});
127
+ return data;
128
+ }
129
+ /**
130
+ * 点击节点
131
+ * @param node 要点击的节点
132
+ * @returns 是否点击成功
133
+ */
134
+ static async click(node) {
135
+ const response = await this.asyncCall(CallMethod.click, { node });
136
+ return response.getDataOrDefault(false);
137
+ }
138
+ /**
139
+ * 长按节点
140
+ * @param node 要长按的节点
141
+ * @returns 是否长按成功
142
+ */
143
+ static async longClick(node) {
144
+ const response = await this.asyncCall(CallMethod.longClick, { node });
145
+ return response.getDataOrDefault(false);
146
+ }
147
+ /**
148
+ * 启动应用
149
+ * @param packageName 应用包名
150
+ * @returns 是否启动成功
151
+ */
152
+ static async launchApp(packageName) {
153
+ const response = await this.asyncCall(CallMethod.launchApp, {
154
+ args: { packageName },
155
+ });
156
+ return response.getDataOrDefault(false);
157
+ }
158
+ /**
159
+ * 获取当前应用包名
160
+ * @returns 包名
161
+ */
162
+ static async getPackageName() {
163
+ const response = await this.asyncCall(CallMethod.getPackageName);
164
+ return response.getDataOrDefault("");
165
+ }
166
+ /**
167
+ * 显示悬浮提示
168
+ * @param text 提示文本
169
+ * @param delay 显示时长(毫秒)
170
+ * @returns 是否显示成功
171
+ */
172
+ static async overlayToast(text, delay = 2000) {
173
+ const response = await this.asyncCall(CallMethod.overlayToast, {
174
+ args: { text, delay },
175
+ });
176
+ return response.getDataOrDefault(false);
177
+ }
178
+ /**
179
+ * 通过ID查找节点
180
+ * @param id 节点ID
181
+ * @param filterClass 类名过滤
182
+ * @param filterText 文本过滤
183
+ * @param filterDes 描述过滤
184
+ * @param node 父节点范围
185
+ * @returns 节点数组
186
+ */
187
+ static async findById(id, { filterClass, filterText, filterDes, node, } = {}) {
188
+ const response = await this.asyncCall(CallMethod.findById, {
189
+ args: { id, filterClass, filterText, filterDes },
190
+ node,
191
+ });
192
+ return Node.fromJSONArray(response.getDataOrDefault("[]"));
193
+ }
194
+ /**
195
+ * 通过文本查找节点
196
+ * @param text 要查找的文本
197
+ * @param filterClass 类名过滤
198
+ * @param filterViewId 视图ID过滤
199
+ * @param filterDes 描述过滤
200
+ * @param node 父节点范围
201
+ * @returns 节点数组
202
+ */
203
+ static async findByText(text, { filterClass, filterViewId, filterDes, node, } = {}) {
204
+ const response = await this.asyncCall(CallMethod.findByText, {
205
+ args: { text, filterClass, filterViewId, filterDes },
206
+ node,
207
+ });
208
+ return Node.fromJSONArray(response.getDataOrDefault("[]"));
209
+ }
210
+ /**
211
+ * 通过标签查找节点
212
+ * @param className 类名
213
+ * @param filterText 文本过滤
214
+ * @param filterViewId 视图ID过滤
215
+ * @param filterDes 描述过滤
216
+ * @param node 父节点范围
217
+ * @returns 节点数组
218
+ */
219
+ static async findByTags(className, { filterText, filterViewId, filterDes, node, } = {}) {
220
+ const response = await this.asyncCall(CallMethod.findByTags, {
221
+ args: { className, filterText, filterViewId, filterDes },
222
+ node,
223
+ });
224
+ return Node.fromJSONArray(response.getDataOrDefault("[]"));
225
+ }
226
+ /**
227
+ * 查找所有匹配文本的节点
228
+ * @param text 要查找的文本
229
+ * @returns 节点数组
230
+ */
231
+ static async findByTextAllMatch(text) {
232
+ const response = await this.asyncCall(CallMethod.findByTextAllMatch, {
233
+ args: { text },
234
+ });
235
+ return Node.fromJSONArray(response.getDataOrDefault("[]"));
236
+ }
237
+ /**
238
+ * 检查是否包含指定文本
239
+ * @param text 要检查的文本
240
+ * @returns 是否包含
241
+ */
242
+ static async containsText(text) {
243
+ const response = await this.asyncCall(CallMethod.containsText, {
244
+ args: { text },
245
+ });
246
+ return response.getDataOrDefault(false);
247
+ }
248
+ /**
249
+ * 获取所有文本
250
+ * @returns 文本数组
251
+ */
252
+ static async getAllText() {
253
+ const response = await this.asyncCall(CallMethod.getAllText);
254
+ return response.getDataOrDefault("[]");
255
+ }
256
+ /**
257
+ * 查找第一个匹配标签的父节点
258
+ * @param className 类名
259
+ * @returns 父节点
260
+ */
261
+ static async findFirstParentByTags(className) {
262
+ const response = await this.asyncCall(CallMethod.findFirstParentByTags, {
263
+ args: { className },
264
+ });
265
+ return Node.create(response.getDataOrDefault("{}"));
266
+ }
267
+ /**
268
+ * 获取节点的所有子节点
269
+ * @param node 父节点
270
+ * @returns 子节点数组
271
+ */
272
+ static async getNodes(node) {
273
+ const response = await this.asyncCall(CallMethod.getNodes, { node });
274
+ return Node.fromJSONArray(response.getDataOrDefault("[]"));
275
+ }
276
+ /**
277
+ * 获取节点的直接子节点
278
+ * @param node 父节点
279
+ * @returns 子节点数组
280
+ */
281
+ static async getChildren(node) {
282
+ const response = await this.asyncCall(CallMethod.getChildren, { node });
283
+ return Node.fromJSONArray(response.getDataOrDefault([]));
284
+ }
285
+ /**
286
+ * 查找第一个可点击的父节点
287
+ * @param node 起始节点
288
+ * @returns 可点击的父节点
289
+ */
290
+ static async findFirstParentClickable(node) {
291
+ const response = await this.asyncCall(CallMethod.findFirstParentClickable, {
292
+ node,
293
+ });
294
+ return Node.create(response.getDataOrDefault("{}"));
295
+ }
296
+ /**
297
+ * 获取节点在屏幕中的边界
298
+ * @param node 目标节点
299
+ * @returns 边界对象
300
+ */
301
+ static async getBoundsInScreen(node) {
302
+ const response = await this.asyncCall(CallMethod.getBoundsInScreen, {
303
+ node,
304
+ });
305
+ return Bounds.fromData(response.getDataOrDefault({}));
306
+ }
307
+ /**
308
+ * 检查节点是否可见
309
+ * @param node 目标节点
310
+ * @param compareNode 比较节点
311
+ * @param isFullyByCompareNode 是否完全可见
312
+ * @returns 是否可见
313
+ */
314
+ static async isVisible(node, { compareNode, isFullyByCompareNode, } = {}) {
315
+ const response = await this.asyncCall(CallMethod.isVisible, {
316
+ node,
317
+ args: { compareNode, isFullyByCompareNode },
318
+ });
319
+ return response.getDataOrDefault(false);
320
+ }
321
+ /**
322
+ * 执行点击手势
323
+ * @param x 横坐标
324
+ * @param y 纵坐标
325
+ * @param duration 持续时间
326
+ * @returns 是否成功
327
+ */
328
+ static async clickByGesture(x, y, duration) {
329
+ const response = await this.asyncCall(CallMethod.clickByGesture, {
330
+ args: { x, y, duration },
331
+ });
332
+ return response.getDataOrDefault(false);
333
+ }
334
+ /**
335
+ * 返回操作
336
+ * @returns 是否成功
337
+ */
338
+ static async back() {
339
+ const response = await this.asyncCall(CallMethod.back);
340
+ return response.getDataOrDefault(false);
341
+ }
342
+ /**
343
+ * 回到主页
344
+ * @returns 是否成功
345
+ */
346
+ static async home() {
347
+ const response = await this.asyncCall(CallMethod.home);
348
+ return response.getDataOrDefault(false);
349
+ }
350
+ /**
351
+ * 打开通知栏
352
+ * @returns 是否成功
353
+ */
354
+ static async notifications() {
355
+ const response = await this.asyncCall(CallMethod.notifications);
356
+ return response.getDataOrDefault(false);
357
+ }
358
+ /**
359
+ * 显示最近应用
360
+ * @returns 是否成功
361
+ */
362
+ static async recentApps() {
363
+ const response = await this.asyncCall(CallMethod.recentApps);
364
+ return response.getDataOrDefault(false);
365
+ }
366
+ /**
367
+ * 在节点中粘贴文本
368
+ * @param node 目标节点
369
+ * @param text 要粘贴的文本
370
+ * @returns 是否成功
371
+ */
372
+ static async paste(node, text) {
373
+ const response = await this.asyncCall(CallMethod.paste, {
374
+ args: { text },
375
+ node,
376
+ });
377
+ return response.getDataOrDefault(false);
378
+ }
379
+ static async focus(node) {
380
+ const response = await this.asyncCall(CallMethod.focus, { node });
381
+ return response.getDataOrDefault(false);
382
+ }
383
+ /**
384
+ * 选择文本
385
+ * @param node 目标节点
386
+ * @param selectionStart 选择起始位置
387
+ * @param selectionEnd 选择结束位置
388
+ * @returns 是否成功
389
+ */
390
+ static async selectionText(node, selectionStart, selectionEnd) {
391
+ const response = await this.asyncCall(CallMethod.selectionText, {
392
+ args: { selectionStart, selectionEnd },
393
+ node,
394
+ });
395
+ return response.getDataOrDefault(false);
396
+ }
397
+ /**
398
+ * 向前滚动
399
+ * @param node 可滚动节点
400
+ * @returns 是否成功
401
+ */
402
+ static async scrollForward(node) {
403
+ const response = await this.asyncCall(CallMethod.scrollForward, {
404
+ node,
405
+ });
406
+ return response.getDataOrDefault(false);
407
+ }
408
+ /**
409
+ * 向后滚动
410
+ * @param node 可滚动节点
411
+ * @returns 是否成功
412
+ */
413
+ static async scrollBackward(node) {
414
+ const response = await this.asyncCall(CallMethod.scrollBackward, {
415
+ node,
416
+ });
417
+ return response.getDataOrDefault(false);
418
+ }
419
+ /**
420
+ * 对节点执行点击手势
421
+ * @param node 目标节点
422
+ * @param offsetX X轴偏移
423
+ * @param offsetY Y轴偏移
424
+ * @param switchWindowIntervalDelay 窗口切换延迟
425
+ * @param clickDuration 点击持续时间
426
+ * @returns 是否成功
427
+ */
428
+ static async clickNodeByGesture(node, { offsetX, offsetY, switchWindowIntervalDelay, clickDuration, } = {}) {
429
+ const response = await this.asyncCall(CallMethod.clickNodeByGesture, {
430
+ node,
431
+ args: { offsetX, offsetY, switchWindowIntervalDelay, clickDuration },
432
+ });
433
+ return response.getDataOrDefault(false);
434
+ }
435
+ /**
436
+ * 对节点执行双击手势
437
+ * @param node 目标节点
438
+ * @param offsetX X轴偏移
439
+ * @param offsetY Y轴偏移
440
+ * @param switchWindowIntervalDelay 窗口切换延迟
441
+ * @param clickDuration 点击持续时间
442
+ * @param clickInterval 点击间隔
443
+ * @returns 是否成功
444
+ */
445
+ static async doubleClickNodeByGesture(node, { offsetX, offsetY, switchWindowIntervalDelay, clickDuration, clickInterval, } = {}) {
446
+ const response = await this.asyncCall(CallMethod.doubleClickNodeByGesture, {
447
+ node,
448
+ args: {
449
+ offsetX,
450
+ offsetY,
451
+ switchWindowIntervalDelay,
452
+ clickDuration,
453
+ clickInterval,
454
+ },
455
+ });
456
+ return response.getDataOrDefault(false);
457
+ }
458
+ /**
459
+ * 执行线型手势
460
+ * @param startPoint
461
+ * @param endPoint
462
+ * @param param2
463
+ * @returns
464
+ */
465
+ static async performLinearGesture(startPoint, endPoint, { duration } = {}) {
466
+ const response = await this.asyncCall(CallMethod.performLinearGesture, {
467
+ args: { startPoint, endPoint, duration },
468
+ });
469
+ return response.getDataOrDefault(false);
470
+ }
471
+ static async longPressNodeByGestureAutoPaste(node, text, { matchedPackageName, matchedText, timeoutMillis, longPressDuration, } = { matchedText: "粘贴", timeoutMillis: 1500, longPressDuration: 600 }) {
472
+ const response = await this.asyncCall(CallMethod.longPressGestureAutoPaste, {
473
+ node,
474
+ args: {
475
+ text,
476
+ matchedPackageName,
477
+ matchedText,
478
+ timeoutMillis,
479
+ longPressDuration,
480
+ },
481
+ });
482
+ return response.getDataOrDefault(false);
483
+ }
484
+ static async longPressGestureAutoPaste(point, text, { matchedPackageName, matchedText, timeoutMillis, longPressDuration, } = { matchedText: "粘贴", timeoutMillis: 1500, longPressDuration: 600 }) {
485
+ const response = await this.asyncCall(CallMethod.longPressGestureAutoPaste, {
486
+ args: {
487
+ point,
488
+ text,
489
+ matchedPackageName,
490
+ matchedText,
491
+ timeoutMillis,
492
+ longPressDuration,
493
+ },
494
+ });
495
+ return response.getDataOrDefault(false);
496
+ }
497
+ static async getAppInfo(packageName) {
498
+ const response = await this.asyncCall(CallMethod.getAppInfo, {
499
+ args: { packageName },
500
+ });
501
+ return response.getDataOrDefault({});
502
+ }
503
+ static async getUniqueDeviceId() {
504
+ const response = await this.asyncCall(CallMethod.getUniqueDeviceId);
505
+ return response.getDataOrDefault("");
506
+ }
507
+ static async getAndroidID() {
508
+ const response = await this.asyncCall(CallMethod.getAndroidID);
509
+ return response.getDataOrDefault("");
510
+ }
511
+ static async getMacAddress() {
512
+ const response = await this.asyncCall(CallMethod.getMacAddress);
513
+ return response.getDataOrDefault({});
514
+ }
515
+ /**
516
+ * 获取屏幕尺寸
517
+ * @returns 屏幕尺寸对象
518
+ */
519
+ static async getScreenSize() {
520
+ const response = await this.asyncCall(CallMethod.getScreenSize);
521
+ return response.getDataOrDefault("{}");
522
+ }
523
+ /**
524
+ * 获取应用窗口尺寸
525
+ * @returns 应用窗口尺寸对象
526
+ */
527
+ static async getAppScreenSize() {
528
+ const response = await this.asyncCall(CallMethod.getAppScreenSize);
529
+ return response.getDataOrDefault("{}");
530
+ }
531
+ }
@@ -22,6 +22,7 @@ export declare const CallMethod: {
22
22
  readonly notifications: "notifications";
23
23
  readonly recentApps: "recentApps";
24
24
  readonly paste: "paste";
25
+ readonly focus: "focus";
25
26
  readonly selectionText: "selectionText";
26
27
  readonly scrollForward: "scrollForward";
27
28
  readonly launchApp: "launchApp";
@@ -23,6 +23,7 @@ export const CallMethod = {
23
23
  notifications: "notifications",
24
24
  recentApps: "recentApps",
25
25
  paste: "paste",
26
+ focus: "focus",
26
27
  selectionText: "selectionText",
27
28
  scrollForward: "scrollForward",
28
29
  launchApp: "launchApp",
package/dist/Node.d.ts CHANGED
@@ -2,7 +2,8 @@
2
2
  * 节点类
3
3
  * 表示界面上的一个可交互元素,包含元素的属性和可执行的操作
4
4
  */
5
- import { Bounds } from './Bounds';
5
+ import { Bounds } from "./Bounds";
6
+ import { NodeAsync } from "./NodeAsync";
6
7
  export declare class Node {
7
8
  /**
8
9
  * 节点唯一标识
@@ -55,6 +56,7 @@ export declare class Node {
55
56
  isEnabled: boolean;
56
57
  stepId: string | undefined;
57
58
  });
59
+ get async(): NodeAsync;
58
60
  /**
59
61
  * 对节点执行点击手势
60
62
  * @param offsetX X轴偏移
@@ -63,7 +65,7 @@ export declare class Node {
63
65
  * @param clickDuration 点击持续时间
64
66
  * @returns 是否点击成功
65
67
  */
66
- clickNodeByGesture({ offsetX, offsetY, switchWindowIntervalDelay, clickDuration }?: {
68
+ clickNodeByGesture({ offsetX, offsetY, switchWindowIntervalDelay, clickDuration, }?: {
67
69
  offsetX?: number;
68
70
  offsetY?: number;
69
71
  switchWindowIntervalDelay?: number;
@@ -78,14 +80,14 @@ export declare class Node {
78
80
  * @param clickInterval 点击间隔
79
81
  * @returns 是否双击成功
80
82
  */
81
- doubleClickNodeByGesture({ offsetX, offsetY, switchWindowIntervalDelay, clickDuration, clickInterval }?: {
83
+ doubleClickNodeByGesture({ offsetX, offsetY, switchWindowIntervalDelay, clickDuration, clickInterval, }?: {
82
84
  offsetX?: number;
83
85
  offsetY?: number;
84
86
  switchWindowIntervalDelay?: number;
85
87
  clickDuration?: number;
86
88
  clickInterval?: number;
87
89
  }): Promise<boolean>;
88
- longPressNodeByGestureAutoPaste(text: string, { matchedPackageName, matchedText, timeoutMillis, longPressDuration }?: {
90
+ longPressNodeByGestureAutoPaste(text: string, { matchedPackageName, matchedText, timeoutMillis, longPressDuration, }?: {
89
91
  matchedPackageName?: string;
90
92
  matchedText?: string;
91
93
  timeoutMillis?: number;
@@ -99,7 +101,7 @@ export declare class Node {
99
101
  * @param filterDes 描述过滤
100
102
  * @returns 节点数组
101
103
  */
102
- findByTags(className: string, { filterText, filterViewId, filterDes }?: {
104
+ findByTags(className: string, { filterText, filterViewId, filterDes, }?: {
103
105
  filterText?: string;
104
106
  filterViewId?: string;
105
107
  filterDes?: string;
@@ -112,7 +114,7 @@ export declare class Node {
112
114
  * @param filterDes 描述过滤
113
115
  * @returns 节点数组
114
116
  */
115
- findById(id: string, { filterClass, filterText, filterDes }?: {
117
+ findById(id: string, { filterClass, filterText, filterDes, }?: {
116
118
  filterClass?: string;
117
119
  filterText?: string;
118
120
  filterDes?: string;
@@ -125,7 +127,7 @@ export declare class Node {
125
127
  * @param filterDes 描述过滤
126
128
  * @returns 节点数组
127
129
  */
128
- findByText(text: string, { filterClass, filterViewId, filterDes }?: {
130
+ findByText(text: string, { filterClass, filterViewId, filterDes, }?: {
129
131
  filterClass?: string;
130
132
  filterViewId?: string;
131
133
  filterDes?: string;
@@ -146,7 +148,7 @@ export declare class Node {
146
148
  * @param isFullyByCompareNode 是否完全可见
147
149
  * @returns 是否可见
148
150
  */
149
- isVisible({ compareNode, isFullyByCompareNode }?: {
151
+ isVisible({ compareNode, isFullyByCompareNode, }?: {
150
152
  compareNode?: Node;
151
153
  isFullyByCompareNode?: boolean;
152
154
  }): boolean;
@@ -163,6 +165,7 @@ export declare class Node {
163
165
  */
164
166
  setNodeText(text: string): boolean;
165
167
  paste(text: string): boolean;
168
+ focus(): boolean;
166
169
  /**
167
170
  * 点击节点
168
171
  * @returns 是否点击成功