@midscene/android 0.26.6 → 0.26.7-beta-20250815153024.0
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/es/index.mjs +21 -16
- package/dist/lib/index.js +21 -16
- package/package.json +4 -4
package/dist/es/index.mjs
CHANGED
|
@@ -30,20 +30,25 @@ class AndroidDevice {
|
|
|
30
30
|
actionSpace() {
|
|
31
31
|
const commonActions = commonWebActionsForWebPage(this);
|
|
32
32
|
commonActions.forEach((action)=>{
|
|
33
|
-
if ('Input' === action.name)
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
33
|
+
if ('Input' === action.name) {
|
|
34
|
+
action.paramSchema = '{ value: string, autoDismissKeyboard?: boolean }';
|
|
35
|
+
action.paramDescription += '`autoDismissKeyboard` is a boolean value, if true, the keyboard will be dismissed after the input is completed. Do not set it unless the user asks you to do so.';
|
|
36
|
+
action.call = async (context, param)=>{
|
|
37
|
+
var _this_options;
|
|
38
|
+
const { element } = context;
|
|
39
|
+
if (element) {
|
|
40
|
+
await this.clearInput(element);
|
|
41
|
+
if (!param || !param.value) return;
|
|
42
|
+
}
|
|
43
|
+
const autoDismissKeyboard = param.autoDismissKeyboard ?? (null == (_this_options = this.options) ? void 0 : _this_options.autoDismissKeyboard);
|
|
44
|
+
await this.keyboard.type(param.value, {
|
|
45
|
+
autoDismissKeyboard
|
|
46
|
+
});
|
|
47
|
+
};
|
|
48
|
+
}
|
|
44
49
|
});
|
|
45
50
|
const allActions = [
|
|
46
|
-
...
|
|
51
|
+
...commonActions,
|
|
47
52
|
{
|
|
48
53
|
name: 'AndroidBackButton',
|
|
49
54
|
description: 'Trigger the system "back" operation on Android devices',
|
|
@@ -313,10 +318,10 @@ ${Object.keys(size).filter((key)=>size[key]).map((key)=>` ${key} size: ${size[k
|
|
|
313
318
|
}
|
|
314
319
|
debugPage('Pulling screenshot file from device');
|
|
315
320
|
await adb.pull(androidScreenshotPath, screenshotPath);
|
|
316
|
-
debugPage(
|
|
321
|
+
debugPage(`adb.pull completed, local path: ${screenshotPath}`);
|
|
317
322
|
screenshotBuffer = await node_fs.promises.readFile(screenshotPath);
|
|
318
323
|
} finally{
|
|
319
|
-
await adb.shell(`rm
|
|
324
|
+
await adb.shell(`rm ${androidScreenshotPath}`);
|
|
320
325
|
}
|
|
321
326
|
}
|
|
322
327
|
debugPage('Resizing screenshot image');
|
|
@@ -518,10 +523,10 @@ ${Object.keys(size).filter((key)=>size[key]).map((key)=>` ${key} size: ${size[k
|
|
|
518
523
|
const adb = await this.getAdb();
|
|
519
524
|
const isChinese = /[\p{Script=Han}\p{sc=Hani}]/u.test(text);
|
|
520
525
|
const IME_STRATEGY = ((null == (_this_options = this.options) ? void 0 : _this_options.imeStrategy) || getAIConfig(MIDSCENE_ANDROID_IME_STRATEGY)) ?? 'always-yadb';
|
|
521
|
-
const
|
|
526
|
+
const shouldAutoDismissKeyboard = (null == options ? void 0 : options.autoDismissKeyboard) ?? (null == (_this_options1 = this.options) ? void 0 : _this_options1.autoDismissKeyboard) ?? true;
|
|
522
527
|
if ('always-yadb' === IME_STRATEGY || 'yadb-for-non-ascii' === IME_STRATEGY && isChinese) await this.execYadb(text);
|
|
523
528
|
else await adb.inputText(text);
|
|
524
|
-
if (true ===
|
|
529
|
+
if (true === shouldAutoDismissKeyboard) await this.hideKeyboard(options);
|
|
525
530
|
}
|
|
526
531
|
async keyboardPress(key) {
|
|
527
532
|
const keyCodeMap = {
|
package/dist/lib/index.js
CHANGED
|
@@ -76,20 +76,25 @@ class AndroidDevice {
|
|
|
76
76
|
actionSpace() {
|
|
77
77
|
const commonActions = (0, web_utils_namespaceObject.commonWebActionsForWebPage)(this);
|
|
78
78
|
commonActions.forEach((action)=>{
|
|
79
|
-
if ('Input' === action.name)
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
79
|
+
if ('Input' === action.name) {
|
|
80
|
+
action.paramSchema = '{ value: string, autoDismissKeyboard?: boolean }';
|
|
81
|
+
action.paramDescription += '`autoDismissKeyboard` is a boolean value, if true, the keyboard will be dismissed after the input is completed. Do not set it unless the user asks you to do so.';
|
|
82
|
+
action.call = async (context, param)=>{
|
|
83
|
+
var _this_options;
|
|
84
|
+
const { element } = context;
|
|
85
|
+
if (element) {
|
|
86
|
+
await this.clearInput(element);
|
|
87
|
+
if (!param || !param.value) return;
|
|
88
|
+
}
|
|
89
|
+
const autoDismissKeyboard = param.autoDismissKeyboard ?? (null == (_this_options = this.options) ? void 0 : _this_options.autoDismissKeyboard);
|
|
90
|
+
await this.keyboard.type(param.value, {
|
|
91
|
+
autoDismissKeyboard
|
|
92
|
+
});
|
|
93
|
+
};
|
|
94
|
+
}
|
|
90
95
|
});
|
|
91
96
|
const allActions = [
|
|
92
|
-
...
|
|
97
|
+
...commonActions,
|
|
93
98
|
{
|
|
94
99
|
name: 'AndroidBackButton',
|
|
95
100
|
description: 'Trigger the system "back" operation on Android devices',
|
|
@@ -359,10 +364,10 @@ ${Object.keys(size).filter((key)=>size[key]).map((key)=>` ${key} size: ${size[k
|
|
|
359
364
|
}
|
|
360
365
|
debugPage('Pulling screenshot file from device');
|
|
361
366
|
await adb.pull(androidScreenshotPath, screenshotPath);
|
|
362
|
-
debugPage(
|
|
367
|
+
debugPage(`adb.pull completed, local path: ${screenshotPath}`);
|
|
363
368
|
screenshotBuffer = await external_node_fs_default().promises.readFile(screenshotPath);
|
|
364
369
|
} finally{
|
|
365
|
-
await adb.shell(`rm
|
|
370
|
+
await adb.shell(`rm ${androidScreenshotPath}`);
|
|
366
371
|
}
|
|
367
372
|
}
|
|
368
373
|
debugPage('Resizing screenshot image');
|
|
@@ -564,10 +569,10 @@ ${Object.keys(size).filter((key)=>size[key]).map((key)=>` ${key} size: ${size[k
|
|
|
564
569
|
const adb = await this.getAdb();
|
|
565
570
|
const isChinese = /[\p{Script=Han}\p{sc=Hani}]/u.test(text);
|
|
566
571
|
const IME_STRATEGY = ((null == (_this_options = this.options) ? void 0 : _this_options.imeStrategy) || (0, core_namespaceObject.getAIConfig)(env_namespaceObject.MIDSCENE_ANDROID_IME_STRATEGY)) ?? 'always-yadb';
|
|
567
|
-
const
|
|
572
|
+
const shouldAutoDismissKeyboard = (null == options ? void 0 : options.autoDismissKeyboard) ?? (null == (_this_options1 = this.options) ? void 0 : _this_options1.autoDismissKeyboard) ?? true;
|
|
568
573
|
if ('always-yadb' === IME_STRATEGY || 'yadb-for-non-ascii' === IME_STRATEGY && isChinese) await this.execYadb(text);
|
|
569
574
|
else await adb.inputText(text);
|
|
570
|
-
if (true ===
|
|
575
|
+
if (true === shouldAutoDismissKeyboard) await this.hideKeyboard(options);
|
|
571
576
|
}
|
|
572
577
|
async keyboardPress(key) {
|
|
573
578
|
const keyCodeMap = {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@midscene/android",
|
|
3
|
-
"version": "0.26.
|
|
3
|
+
"version": "0.26.7-beta-20250815153024.0",
|
|
4
4
|
"description": "Android automation library for Midscene",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Android UI automation",
|
|
@@ -27,9 +27,9 @@
|
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"appium-adb": "12.12.1",
|
|
30
|
-
"@midscene/core": "0.26.
|
|
31
|
-
"@midscene/
|
|
32
|
-
"@midscene/
|
|
30
|
+
"@midscene/core": "0.26.7-beta-20250815153024.0",
|
|
31
|
+
"@midscene/web": "0.26.7-beta-20250815153024.0",
|
|
32
|
+
"@midscene/shared": "0.26.7-beta-20250815153024.0"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"@microsoft/api-extractor": "^7.52.10",
|