@midscene/android 1.10.1 → 1.10.2-beta-20260706032158.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/cli.mjs +30 -11
- package/dist/es/index.mjs +29 -10
- package/dist/lib/cli.js +30 -11
- package/dist/lib/index.js +29 -10
- package/package.json +4 -4
package/dist/es/cli.mjs
CHANGED
|
@@ -1300,12 +1300,19 @@ ${Object.keys(size).filter((key)=>size[key]).map((key)=>` ${key} size: ${size[k
|
|
|
1300
1300
|
x: element.center[0],
|
|
1301
1301
|
y: element.center[1]
|
|
1302
1302
|
});
|
|
1303
|
-
await this.ensureYadb();
|
|
1304
1303
|
const adb = await this.getAdb();
|
|
1304
|
+
const displayArg = this.getDisplayArg();
|
|
1305
|
+
const isNonDefaultDisplay = 'number' == typeof this.options?.displayId && 0 !== this.options.displayId;
|
|
1305
1306
|
const IME_STRATEGY = (this.options?.imeStrategy || globalConfigManager.getEnvConfigValue(MIDSCENE_ANDROID_IME_STRATEGY)) ?? IME_STRATEGY_YADB_FOR_NON_ASCII;
|
|
1306
|
-
if (
|
|
1307
|
-
|
|
1308
|
-
|
|
1307
|
+
if (isNonDefaultDisplay) {
|
|
1308
|
+
const keys = [];
|
|
1309
|
+
for(let i = 0; i < 100; i++)keys.push('67', '112');
|
|
1310
|
+
await adb.shell(`input${displayArg} keyevent ${keys.join(' ')}`);
|
|
1311
|
+
} else if (IME_STRATEGY === IME_STRATEGY_YADB_FOR_NON_ASCII) {
|
|
1312
|
+
await this.ensureYadb();
|
|
1313
|
+
await adb.clearTextField(100);
|
|
1314
|
+
} else {
|
|
1315
|
+
await this.ensureYadb();
|
|
1309
1316
|
await adb.shell('app_process -Djava.class.path=/data/local/tmp/yadb /data/local/tmp com.ysbing.yadb.Main -keyboardClear');
|
|
1310
1317
|
}
|
|
1311
1318
|
if (await adb.isSoftKeyboardPresent()) return;
|
|
@@ -1477,13 +1484,24 @@ ${Object.keys(size).filter((key)=>size[key]).map((key)=>` ${key} size: ${size[k
|
|
|
1477
1484
|
const adb = await this.getAdb();
|
|
1478
1485
|
const IME_STRATEGY = (this.options?.imeStrategy || globalConfigManager.getEnvConfigValue(MIDSCENE_ANDROID_IME_STRATEGY)) ?? IME_STRATEGY_YADB_FOR_NON_ASCII;
|
|
1479
1486
|
const shouldAutoDismissKeyboard = options?.autoDismissKeyboard ?? this.options?.autoDismissKeyboard ?? true;
|
|
1480
|
-
const
|
|
1487
|
+
const typeDelay = options?.keyboardTypeDelay ?? this.options?.keyboardTypeDelay;
|
|
1488
|
+
const isNonDefaultDisplay = 'number' == typeof this.options?.displayId && 0 !== this.options.displayId;
|
|
1489
|
+
const useYadb = !isNonDefaultDisplay && (IME_STRATEGY === IME_STRATEGY_ALWAYS_YADB || IME_STRATEGY === IME_STRATEGY_YADB_FOR_NON_ASCII && this.shouldUseYadbForText(text));
|
|
1481
1490
|
if (useYadb) await this.execYadb(escapeForShell(text));
|
|
1482
1491
|
else {
|
|
1492
|
+
const displayArg = this.getDisplayArg();
|
|
1483
1493
|
const segments = text.split('\n');
|
|
1484
1494
|
for(let i = 0; i < segments.length; i++){
|
|
1485
|
-
if (segments[i].length > 0)
|
|
1486
|
-
|
|
1495
|
+
if (segments[i].length > 0) if (typeDelay && typeDelay > 0) for (const ch of segments[i]){
|
|
1496
|
+
const escaped = ' ' === ch ? '%s' : ch;
|
|
1497
|
+
await adb.shell(`input${displayArg} text ${escaped}`);
|
|
1498
|
+
await sleep(typeDelay);
|
|
1499
|
+
}
|
|
1500
|
+
else {
|
|
1501
|
+
const escaped = segments[i].replace(/ /g, '%s');
|
|
1502
|
+
await adb.shell(`input${displayArg} text ${escaped}`);
|
|
1503
|
+
}
|
|
1504
|
+
if (i < segments.length - 1) await adb.shell(`input${displayArg} keyevent 66`);
|
|
1487
1505
|
}
|
|
1488
1506
|
}
|
|
1489
1507
|
if (true === shouldAutoDismissKeyboard) await this.hideKeyboard(options);
|
|
@@ -1523,12 +1541,13 @@ ${Object.keys(size).filter((key)=>size[key]).map((key)=>` ${key} size: ${size[k
|
|
|
1523
1541
|
End: 123
|
|
1524
1542
|
};
|
|
1525
1543
|
const adb = await this.getAdb();
|
|
1544
|
+
const displayArg = this.getDisplayArg();
|
|
1526
1545
|
const normalizedKey = this.normalizeKeyName(key);
|
|
1527
1546
|
const keyCode = keyCodeMap[normalizedKey];
|
|
1528
|
-
if (void 0 !== keyCode) await adb.keyevent
|
|
1547
|
+
if (void 0 !== keyCode) await adb.shell(`input${displayArg} keyevent ${keyCode}`);
|
|
1529
1548
|
else if (1 === key.length) {
|
|
1530
1549
|
const asciiCode = key.toUpperCase().charCodeAt(0);
|
|
1531
|
-
if (asciiCode >= 65 && asciiCode <= 90) await adb.keyevent
|
|
1550
|
+
if (asciiCode >= 65 && asciiCode <= 90) await adb.shell(`input${displayArg} keyevent ${asciiCode - 36}`);
|
|
1532
1551
|
}
|
|
1533
1552
|
}
|
|
1534
1553
|
async tapPoint(point) {
|
|
@@ -1722,7 +1741,7 @@ ${Object.keys(size).filter((key)=>size[key]).map((key)=>` ${key} size: ${size[k
|
|
|
1722
1741
|
4
|
|
1723
1742
|
];
|
|
1724
1743
|
for (const keyCode of keyCodes){
|
|
1725
|
-
await adb.keyevent
|
|
1744
|
+
await adb.shell(`input${this.getDisplayArg()} keyevent ${keyCode}`);
|
|
1726
1745
|
const startTime = Date.now();
|
|
1727
1746
|
const intervalMs = 100;
|
|
1728
1747
|
while(Date.now() - startTime < timeoutMs){
|
|
@@ -2068,7 +2087,7 @@ class AndroidMidsceneTools extends BaseMidsceneTools {
|
|
|
2068
2087
|
const tools = new AndroidMidsceneTools();
|
|
2069
2088
|
runToolsCLI(tools, 'midscene-android', {
|
|
2070
2089
|
stripPrefix: 'android_',
|
|
2071
|
-
version: "1.10.
|
|
2090
|
+
version: "1.10.2-beta-20260706032158.0",
|
|
2072
2091
|
extraCommands: createReportCliCommands()
|
|
2073
2092
|
}).catch((e)=>{
|
|
2074
2093
|
process.exit(reportCLIError(e));
|
package/dist/es/index.mjs
CHANGED
|
@@ -1203,12 +1203,19 @@ ${Object.keys(size).filter((key)=>size[key]).map((key)=>` ${key} size: ${size[k
|
|
|
1203
1203
|
x: element.center[0],
|
|
1204
1204
|
y: element.center[1]
|
|
1205
1205
|
});
|
|
1206
|
-
await this.ensureYadb();
|
|
1207
1206
|
const adb = await this.getAdb();
|
|
1207
|
+
const displayArg = this.getDisplayArg();
|
|
1208
|
+
const isNonDefaultDisplay = 'number' == typeof this.options?.displayId && 0 !== this.options.displayId;
|
|
1208
1209
|
const IME_STRATEGY = (this.options?.imeStrategy || globalConfigManager.getEnvConfigValue(MIDSCENE_ANDROID_IME_STRATEGY)) ?? IME_STRATEGY_YADB_FOR_NON_ASCII;
|
|
1209
|
-
if (
|
|
1210
|
-
|
|
1211
|
-
|
|
1210
|
+
if (isNonDefaultDisplay) {
|
|
1211
|
+
const keys = [];
|
|
1212
|
+
for(let i = 0; i < 100; i++)keys.push('67', '112');
|
|
1213
|
+
await adb.shell(`input${displayArg} keyevent ${keys.join(' ')}`);
|
|
1214
|
+
} else if (IME_STRATEGY === IME_STRATEGY_YADB_FOR_NON_ASCII) {
|
|
1215
|
+
await this.ensureYadb();
|
|
1216
|
+
await adb.clearTextField(100);
|
|
1217
|
+
} else {
|
|
1218
|
+
await this.ensureYadb();
|
|
1212
1219
|
await adb.shell('app_process -Djava.class.path=/data/local/tmp/yadb /data/local/tmp com.ysbing.yadb.Main -keyboardClear');
|
|
1213
1220
|
}
|
|
1214
1221
|
if (await adb.isSoftKeyboardPresent()) return;
|
|
@@ -1380,13 +1387,24 @@ ${Object.keys(size).filter((key)=>size[key]).map((key)=>` ${key} size: ${size[k
|
|
|
1380
1387
|
const adb = await this.getAdb();
|
|
1381
1388
|
const IME_STRATEGY = (this.options?.imeStrategy || globalConfigManager.getEnvConfigValue(MIDSCENE_ANDROID_IME_STRATEGY)) ?? IME_STRATEGY_YADB_FOR_NON_ASCII;
|
|
1382
1389
|
const shouldAutoDismissKeyboard = options?.autoDismissKeyboard ?? this.options?.autoDismissKeyboard ?? true;
|
|
1383
|
-
const
|
|
1390
|
+
const typeDelay = options?.keyboardTypeDelay ?? this.options?.keyboardTypeDelay;
|
|
1391
|
+
const isNonDefaultDisplay = 'number' == typeof this.options?.displayId && 0 !== this.options.displayId;
|
|
1392
|
+
const useYadb = !isNonDefaultDisplay && (IME_STRATEGY === IME_STRATEGY_ALWAYS_YADB || IME_STRATEGY === IME_STRATEGY_YADB_FOR_NON_ASCII && this.shouldUseYadbForText(text));
|
|
1384
1393
|
if (useYadb) await this.execYadb(escapeForShell(text));
|
|
1385
1394
|
else {
|
|
1395
|
+
const displayArg = this.getDisplayArg();
|
|
1386
1396
|
const segments = text.split('\n');
|
|
1387
1397
|
for(let i = 0; i < segments.length; i++){
|
|
1388
|
-
if (segments[i].length > 0)
|
|
1389
|
-
|
|
1398
|
+
if (segments[i].length > 0) if (typeDelay && typeDelay > 0) for (const ch of segments[i]){
|
|
1399
|
+
const escaped = ' ' === ch ? '%s' : ch;
|
|
1400
|
+
await adb.shell(`input${displayArg} text ${escaped}`);
|
|
1401
|
+
await sleep(typeDelay);
|
|
1402
|
+
}
|
|
1403
|
+
else {
|
|
1404
|
+
const escaped = segments[i].replace(/ /g, '%s');
|
|
1405
|
+
await adb.shell(`input${displayArg} text ${escaped}`);
|
|
1406
|
+
}
|
|
1407
|
+
if (i < segments.length - 1) await adb.shell(`input${displayArg} keyevent 66`);
|
|
1390
1408
|
}
|
|
1391
1409
|
}
|
|
1392
1410
|
if (true === shouldAutoDismissKeyboard) await this.hideKeyboard(options);
|
|
@@ -1426,12 +1444,13 @@ ${Object.keys(size).filter((key)=>size[key]).map((key)=>` ${key} size: ${size[k
|
|
|
1426
1444
|
End: 123
|
|
1427
1445
|
};
|
|
1428
1446
|
const adb = await this.getAdb();
|
|
1447
|
+
const displayArg = this.getDisplayArg();
|
|
1429
1448
|
const normalizedKey = this.normalizeKeyName(key);
|
|
1430
1449
|
const keyCode = keyCodeMap[normalizedKey];
|
|
1431
|
-
if (void 0 !== keyCode) await adb.keyevent
|
|
1450
|
+
if (void 0 !== keyCode) await adb.shell(`input${displayArg} keyevent ${keyCode}`);
|
|
1432
1451
|
else if (1 === key.length) {
|
|
1433
1452
|
const asciiCode = key.toUpperCase().charCodeAt(0);
|
|
1434
|
-
if (asciiCode >= 65 && asciiCode <= 90) await adb.keyevent
|
|
1453
|
+
if (asciiCode >= 65 && asciiCode <= 90) await adb.shell(`input${displayArg} keyevent ${asciiCode - 36}`);
|
|
1435
1454
|
}
|
|
1436
1455
|
}
|
|
1437
1456
|
async tapPoint(point) {
|
|
@@ -1625,7 +1644,7 @@ ${Object.keys(size).filter((key)=>size[key]).map((key)=>` ${key} size: ${size[k
|
|
|
1625
1644
|
4
|
|
1626
1645
|
];
|
|
1627
1646
|
for (const keyCode of keyCodes){
|
|
1628
|
-
await adb.keyevent
|
|
1647
|
+
await adb.shell(`input${this.getDisplayArg()} keyevent ${keyCode}`);
|
|
1629
1648
|
const startTime = Date.now();
|
|
1630
1649
|
const intervalMs = 100;
|
|
1631
1650
|
while(Date.now() - startTime < timeoutMs){
|
package/dist/lib/cli.js
CHANGED
|
@@ -1315,12 +1315,19 @@ ${Object.keys(size).filter((key)=>size[key]).map((key)=>` ${key} size: ${size[k
|
|
|
1315
1315
|
x: element.center[0],
|
|
1316
1316
|
y: element.center[1]
|
|
1317
1317
|
});
|
|
1318
|
-
await this.ensureYadb();
|
|
1319
1318
|
const adb = await this.getAdb();
|
|
1319
|
+
const displayArg = this.getDisplayArg();
|
|
1320
|
+
const isNonDefaultDisplay = 'number' == typeof this.options?.displayId && 0 !== this.options.displayId;
|
|
1320
1321
|
const IME_STRATEGY = (this.options?.imeStrategy || env_namespaceObject.globalConfigManager.getEnvConfigValue(env_namespaceObject.MIDSCENE_ANDROID_IME_STRATEGY)) ?? IME_STRATEGY_YADB_FOR_NON_ASCII;
|
|
1321
|
-
if (
|
|
1322
|
-
|
|
1323
|
-
|
|
1322
|
+
if (isNonDefaultDisplay) {
|
|
1323
|
+
const keys = [];
|
|
1324
|
+
for(let i = 0; i < 100; i++)keys.push('67', '112');
|
|
1325
|
+
await adb.shell(`input${displayArg} keyevent ${keys.join(' ')}`);
|
|
1326
|
+
} else if (IME_STRATEGY === IME_STRATEGY_YADB_FOR_NON_ASCII) {
|
|
1327
|
+
await this.ensureYadb();
|
|
1328
|
+
await adb.clearTextField(100);
|
|
1329
|
+
} else {
|
|
1330
|
+
await this.ensureYadb();
|
|
1324
1331
|
await adb.shell('app_process -Djava.class.path=/data/local/tmp/yadb /data/local/tmp com.ysbing.yadb.Main -keyboardClear');
|
|
1325
1332
|
}
|
|
1326
1333
|
if (await adb.isSoftKeyboardPresent()) return;
|
|
@@ -1492,13 +1499,24 @@ ${Object.keys(size).filter((key)=>size[key]).map((key)=>` ${key} size: ${size[k
|
|
|
1492
1499
|
const adb = await this.getAdb();
|
|
1493
1500
|
const IME_STRATEGY = (this.options?.imeStrategy || env_namespaceObject.globalConfigManager.getEnvConfigValue(env_namespaceObject.MIDSCENE_ANDROID_IME_STRATEGY)) ?? IME_STRATEGY_YADB_FOR_NON_ASCII;
|
|
1494
1501
|
const shouldAutoDismissKeyboard = options?.autoDismissKeyboard ?? this.options?.autoDismissKeyboard ?? true;
|
|
1495
|
-
const
|
|
1502
|
+
const typeDelay = options?.keyboardTypeDelay ?? this.options?.keyboardTypeDelay;
|
|
1503
|
+
const isNonDefaultDisplay = 'number' == typeof this.options?.displayId && 0 !== this.options.displayId;
|
|
1504
|
+
const useYadb = !isNonDefaultDisplay && (IME_STRATEGY === IME_STRATEGY_ALWAYS_YADB || IME_STRATEGY === IME_STRATEGY_YADB_FOR_NON_ASCII && this.shouldUseYadbForText(text));
|
|
1496
1505
|
if (useYadb) await this.execYadb(escapeForShell(text));
|
|
1497
1506
|
else {
|
|
1507
|
+
const displayArg = this.getDisplayArg();
|
|
1498
1508
|
const segments = text.split('\n');
|
|
1499
1509
|
for(let i = 0; i < segments.length; i++){
|
|
1500
|
-
if (segments[i].length > 0)
|
|
1501
|
-
|
|
1510
|
+
if (segments[i].length > 0) if (typeDelay && typeDelay > 0) for (const ch of segments[i]){
|
|
1511
|
+
const escaped = ' ' === ch ? '%s' : ch;
|
|
1512
|
+
await adb.shell(`input${displayArg} text ${escaped}`);
|
|
1513
|
+
await (0, core_utils_namespaceObject.sleep)(typeDelay);
|
|
1514
|
+
}
|
|
1515
|
+
else {
|
|
1516
|
+
const escaped = segments[i].replace(/ /g, '%s');
|
|
1517
|
+
await adb.shell(`input${displayArg} text ${escaped}`);
|
|
1518
|
+
}
|
|
1519
|
+
if (i < segments.length - 1) await adb.shell(`input${displayArg} keyevent 66`);
|
|
1502
1520
|
}
|
|
1503
1521
|
}
|
|
1504
1522
|
if (true === shouldAutoDismissKeyboard) await this.hideKeyboard(options);
|
|
@@ -1538,12 +1556,13 @@ ${Object.keys(size).filter((key)=>size[key]).map((key)=>` ${key} size: ${size[k
|
|
|
1538
1556
|
End: 123
|
|
1539
1557
|
};
|
|
1540
1558
|
const adb = await this.getAdb();
|
|
1559
|
+
const displayArg = this.getDisplayArg();
|
|
1541
1560
|
const normalizedKey = this.normalizeKeyName(key);
|
|
1542
1561
|
const keyCode = keyCodeMap[normalizedKey];
|
|
1543
|
-
if (void 0 !== keyCode) await adb.keyevent
|
|
1562
|
+
if (void 0 !== keyCode) await adb.shell(`input${displayArg} keyevent ${keyCode}`);
|
|
1544
1563
|
else if (1 === key.length) {
|
|
1545
1564
|
const asciiCode = key.toUpperCase().charCodeAt(0);
|
|
1546
|
-
if (asciiCode >= 65 && asciiCode <= 90) await adb.keyevent
|
|
1565
|
+
if (asciiCode >= 65 && asciiCode <= 90) await adb.shell(`input${displayArg} keyevent ${asciiCode - 36}`);
|
|
1547
1566
|
}
|
|
1548
1567
|
}
|
|
1549
1568
|
async tapPoint(point) {
|
|
@@ -1737,7 +1756,7 @@ ${Object.keys(size).filter((key)=>size[key]).map((key)=>` ${key} size: ${size[k
|
|
|
1737
1756
|
4
|
|
1738
1757
|
];
|
|
1739
1758
|
for (const keyCode of keyCodes){
|
|
1740
|
-
await adb.keyevent
|
|
1759
|
+
await adb.shell(`input${this.getDisplayArg()} keyevent ${keyCode}`);
|
|
1741
1760
|
const startTime = Date.now();
|
|
1742
1761
|
const intervalMs = 100;
|
|
1743
1762
|
while(Date.now() - startTime < timeoutMs){
|
|
@@ -2083,7 +2102,7 @@ ${Object.keys(size).filter((key)=>size[key]).map((key)=>` ${key} size: ${size[k
|
|
|
2083
2102
|
const tools = new AndroidMidsceneTools();
|
|
2084
2103
|
(0, cli_namespaceObject.runToolsCLI)(tools, 'midscene-android', {
|
|
2085
2104
|
stripPrefix: 'android_',
|
|
2086
|
-
version: "1.10.
|
|
2105
|
+
version: "1.10.2-beta-20260706032158.0",
|
|
2087
2106
|
extraCommands: (0, core_namespaceObject.createReportCliCommands)()
|
|
2088
2107
|
}).catch((e)=>{
|
|
2089
2108
|
process.exit((0, cli_namespaceObject.reportCLIError)(e));
|
package/dist/lib/index.js
CHANGED
|
@@ -1236,12 +1236,19 @@ ${Object.keys(size).filter((key)=>size[key]).map((key)=>` ${key} size: ${size[k
|
|
|
1236
1236
|
x: element.center[0],
|
|
1237
1237
|
y: element.center[1]
|
|
1238
1238
|
});
|
|
1239
|
-
await this.ensureYadb();
|
|
1240
1239
|
const adb = await this.getAdb();
|
|
1240
|
+
const displayArg = this.getDisplayArg();
|
|
1241
|
+
const isNonDefaultDisplay = 'number' == typeof this.options?.displayId && 0 !== this.options.displayId;
|
|
1241
1242
|
const IME_STRATEGY = (this.options?.imeStrategy || env_namespaceObject.globalConfigManager.getEnvConfigValue(env_namespaceObject.MIDSCENE_ANDROID_IME_STRATEGY)) ?? IME_STRATEGY_YADB_FOR_NON_ASCII;
|
|
1242
|
-
if (
|
|
1243
|
-
|
|
1244
|
-
|
|
1243
|
+
if (isNonDefaultDisplay) {
|
|
1244
|
+
const keys = [];
|
|
1245
|
+
for(let i = 0; i < 100; i++)keys.push('67', '112');
|
|
1246
|
+
await adb.shell(`input${displayArg} keyevent ${keys.join(' ')}`);
|
|
1247
|
+
} else if (IME_STRATEGY === IME_STRATEGY_YADB_FOR_NON_ASCII) {
|
|
1248
|
+
await this.ensureYadb();
|
|
1249
|
+
await adb.clearTextField(100);
|
|
1250
|
+
} else {
|
|
1251
|
+
await this.ensureYadb();
|
|
1245
1252
|
await adb.shell('app_process -Djava.class.path=/data/local/tmp/yadb /data/local/tmp com.ysbing.yadb.Main -keyboardClear');
|
|
1246
1253
|
}
|
|
1247
1254
|
if (await adb.isSoftKeyboardPresent()) return;
|
|
@@ -1413,13 +1420,24 @@ ${Object.keys(size).filter((key)=>size[key]).map((key)=>` ${key} size: ${size[k
|
|
|
1413
1420
|
const adb = await this.getAdb();
|
|
1414
1421
|
const IME_STRATEGY = (this.options?.imeStrategy || env_namespaceObject.globalConfigManager.getEnvConfigValue(env_namespaceObject.MIDSCENE_ANDROID_IME_STRATEGY)) ?? IME_STRATEGY_YADB_FOR_NON_ASCII;
|
|
1415
1422
|
const shouldAutoDismissKeyboard = options?.autoDismissKeyboard ?? this.options?.autoDismissKeyboard ?? true;
|
|
1416
|
-
const
|
|
1423
|
+
const typeDelay = options?.keyboardTypeDelay ?? this.options?.keyboardTypeDelay;
|
|
1424
|
+
const isNonDefaultDisplay = 'number' == typeof this.options?.displayId && 0 !== this.options.displayId;
|
|
1425
|
+
const useYadb = !isNonDefaultDisplay && (IME_STRATEGY === IME_STRATEGY_ALWAYS_YADB || IME_STRATEGY === IME_STRATEGY_YADB_FOR_NON_ASCII && this.shouldUseYadbForText(text));
|
|
1417
1426
|
if (useYadb) await this.execYadb(escapeForShell(text));
|
|
1418
1427
|
else {
|
|
1428
|
+
const displayArg = this.getDisplayArg();
|
|
1419
1429
|
const segments = text.split('\n');
|
|
1420
1430
|
for(let i = 0; i < segments.length; i++){
|
|
1421
|
-
if (segments[i].length > 0)
|
|
1422
|
-
|
|
1431
|
+
if (segments[i].length > 0) if (typeDelay && typeDelay > 0) for (const ch of segments[i]){
|
|
1432
|
+
const escaped = ' ' === ch ? '%s' : ch;
|
|
1433
|
+
await adb.shell(`input${displayArg} text ${escaped}`);
|
|
1434
|
+
await (0, utils_namespaceObject.sleep)(typeDelay);
|
|
1435
|
+
}
|
|
1436
|
+
else {
|
|
1437
|
+
const escaped = segments[i].replace(/ /g, '%s');
|
|
1438
|
+
await adb.shell(`input${displayArg} text ${escaped}`);
|
|
1439
|
+
}
|
|
1440
|
+
if (i < segments.length - 1) await adb.shell(`input${displayArg} keyevent 66`);
|
|
1423
1441
|
}
|
|
1424
1442
|
}
|
|
1425
1443
|
if (true === shouldAutoDismissKeyboard) await this.hideKeyboard(options);
|
|
@@ -1459,12 +1477,13 @@ ${Object.keys(size).filter((key)=>size[key]).map((key)=>` ${key} size: ${size[k
|
|
|
1459
1477
|
End: 123
|
|
1460
1478
|
};
|
|
1461
1479
|
const adb = await this.getAdb();
|
|
1480
|
+
const displayArg = this.getDisplayArg();
|
|
1462
1481
|
const normalizedKey = this.normalizeKeyName(key);
|
|
1463
1482
|
const keyCode = keyCodeMap[normalizedKey];
|
|
1464
|
-
if (void 0 !== keyCode) await adb.keyevent
|
|
1483
|
+
if (void 0 !== keyCode) await adb.shell(`input${displayArg} keyevent ${keyCode}`);
|
|
1465
1484
|
else if (1 === key.length) {
|
|
1466
1485
|
const asciiCode = key.toUpperCase().charCodeAt(0);
|
|
1467
|
-
if (asciiCode >= 65 && asciiCode <= 90) await adb.keyevent
|
|
1486
|
+
if (asciiCode >= 65 && asciiCode <= 90) await adb.shell(`input${displayArg} keyevent ${asciiCode - 36}`);
|
|
1468
1487
|
}
|
|
1469
1488
|
}
|
|
1470
1489
|
async tapPoint(point) {
|
|
@@ -1658,7 +1677,7 @@ ${Object.keys(size).filter((key)=>size[key]).map((key)=>` ${key} size: ${size[k
|
|
|
1658
1677
|
4
|
|
1659
1678
|
];
|
|
1660
1679
|
for (const keyCode of keyCodes){
|
|
1661
|
-
await adb.keyevent
|
|
1680
|
+
await adb.shell(`input${this.getDisplayArg()} keyevent ${keyCode}`);
|
|
1662
1681
|
const startTime = Date.now();
|
|
1663
1682
|
const intervalMs = 100;
|
|
1664
1683
|
while(Date.now() - startTime < timeoutMs){
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@midscene/android",
|
|
3
|
-
"version": "1.10.
|
|
3
|
+
"version": "1.10.2-beta-20260706032158.0",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/web-infra-dev/midscene.git",
|
|
@@ -41,8 +41,8 @@
|
|
|
41
41
|
"@yume-chan/stream-extra": "2.1.0",
|
|
42
42
|
"appium-adb": "12.12.1",
|
|
43
43
|
"sharp": "^0.34.3",
|
|
44
|
-
"@midscene/
|
|
45
|
-
"@midscene/
|
|
44
|
+
"@midscene/core": "1.10.2-beta-20260706032158.0",
|
|
45
|
+
"@midscene/shared": "1.10.2-beta-20260706032158.0"
|
|
46
46
|
},
|
|
47
47
|
"optionalDependencies": {
|
|
48
48
|
"@ffmpeg-installer/ffmpeg": "^1.1.0"
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
"undici": "^6.0.0",
|
|
57
57
|
"vitest": "3.0.5",
|
|
58
58
|
"zod": "^3.25.1",
|
|
59
|
-
"@midscene/playground": "1.10.
|
|
59
|
+
"@midscene/playground": "1.10.2-beta-20260706032158.0"
|
|
60
60
|
},
|
|
61
61
|
"license": "MIT",
|
|
62
62
|
"scripts": {
|