bb-browser 0.1.1 → 0.1.2
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/cli.js +83 -52
- package/dist/cli.js.map +1 -1
- package/extension/dist/background.js +139 -85
- package/extension/dist/background.js.map +1 -1
- package/extension/dist/manifest.json +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -186,7 +186,8 @@ async function snapshotCommand(options = {}) {
|
|
|
186
186
|
const request = {
|
|
187
187
|
id: generateId(),
|
|
188
188
|
action: "snapshot",
|
|
189
|
-
interactive: options.interactive
|
|
189
|
+
interactive: options.interactive,
|
|
190
|
+
tabId: options.tabId
|
|
190
191
|
};
|
|
191
192
|
const response = await sendCommand(request);
|
|
192
193
|
if (options.json) {
|
|
@@ -219,7 +220,8 @@ async function clickCommand(ref, options = {}) {
|
|
|
219
220
|
const request = {
|
|
220
221
|
id: generateId(),
|
|
221
222
|
action: "click",
|
|
222
|
-
ref: parsedRef
|
|
223
|
+
ref: parsedRef,
|
|
224
|
+
tabId: options.tabId
|
|
223
225
|
};
|
|
224
226
|
const response = await sendCommand(request);
|
|
225
227
|
if (options.json) {
|
|
@@ -253,7 +255,8 @@ async function hoverCommand(ref, options = {}) {
|
|
|
253
255
|
const request = {
|
|
254
256
|
id: generateId(),
|
|
255
257
|
action: "hover",
|
|
256
|
-
ref: parsedRef
|
|
258
|
+
ref: parsedRef,
|
|
259
|
+
tabId: options.tabId
|
|
257
260
|
};
|
|
258
261
|
const response = await sendCommand(request);
|
|
259
262
|
if (options.json) {
|
|
@@ -291,7 +294,8 @@ async function fillCommand(ref, text, options = {}) {
|
|
|
291
294
|
id: generateId(),
|
|
292
295
|
action: "fill",
|
|
293
296
|
ref: parsedRef,
|
|
294
|
-
text
|
|
297
|
+
text,
|
|
298
|
+
tabId: options.tabId
|
|
295
299
|
};
|
|
296
300
|
const response = await sendCommand(request);
|
|
297
301
|
if (options.json) {
|
|
@@ -330,7 +334,8 @@ async function typeCommand(ref, text, options = {}) {
|
|
|
330
334
|
id: generateId(),
|
|
331
335
|
action: "type",
|
|
332
336
|
ref: parsedRef,
|
|
333
|
-
text
|
|
337
|
+
text,
|
|
338
|
+
tabId: options.tabId
|
|
334
339
|
};
|
|
335
340
|
const response = await sendCommand(request);
|
|
336
341
|
if (options.json) {
|
|
@@ -357,7 +362,8 @@ async function closeCommand(options = {}) {
|
|
|
357
362
|
await ensureDaemonRunning();
|
|
358
363
|
const request = {
|
|
359
364
|
id: generateId(),
|
|
360
|
-
action: "close"
|
|
365
|
+
action: "close",
|
|
366
|
+
tabId: options.tabId
|
|
361
367
|
};
|
|
362
368
|
const response = await sendCommand(request);
|
|
363
369
|
if (options.json) {
|
|
@@ -390,7 +396,8 @@ async function getCommand(attribute, ref, options = {}) {
|
|
|
390
396
|
id: generateId(),
|
|
391
397
|
action: "get",
|
|
392
398
|
attribute,
|
|
393
|
-
ref: ref ? parseRef5(ref) : void 0
|
|
399
|
+
ref: ref ? parseRef5(ref) : void 0,
|
|
400
|
+
tabId: options.tabId
|
|
394
401
|
};
|
|
395
402
|
const response = await sendCommand(request);
|
|
396
403
|
if (options.json) {
|
|
@@ -429,7 +436,8 @@ async function screenshotCommand(outputPath, options = {}) {
|
|
|
429
436
|
const filePath = outputPath ? path.resolve(outputPath) : getDefaultPath();
|
|
430
437
|
const request = {
|
|
431
438
|
id: generateId(),
|
|
432
|
-
action: "screenshot"
|
|
439
|
+
action: "screenshot",
|
|
440
|
+
tabId: options.tabId
|
|
433
441
|
};
|
|
434
442
|
const response = await sendCommand(request);
|
|
435
443
|
if (response.success && response.data?.dataUrl) {
|
|
@@ -473,7 +481,8 @@ async function waitCommand(target, options = {}) {
|
|
|
473
481
|
id: generateId(),
|
|
474
482
|
action: "wait",
|
|
475
483
|
waitType: "time",
|
|
476
|
-
ms
|
|
484
|
+
ms,
|
|
485
|
+
tabId: options.tabId
|
|
477
486
|
};
|
|
478
487
|
} else {
|
|
479
488
|
const ref = parseRef6(target);
|
|
@@ -481,7 +490,8 @@ async function waitCommand(target, options = {}) {
|
|
|
481
490
|
id: generateId(),
|
|
482
491
|
action: "wait",
|
|
483
492
|
waitType: "element",
|
|
484
|
-
ref
|
|
493
|
+
ref,
|
|
494
|
+
tabId: options.tabId
|
|
485
495
|
};
|
|
486
496
|
}
|
|
487
497
|
const response = await sendCommand(request);
|
|
@@ -529,7 +539,8 @@ async function pressCommand(keyString, options = {}) {
|
|
|
529
539
|
id: generateId(),
|
|
530
540
|
action: "press",
|
|
531
541
|
key,
|
|
532
|
-
modifiers
|
|
542
|
+
modifiers,
|
|
543
|
+
tabId: options.tabId
|
|
533
544
|
};
|
|
534
545
|
const response = await sendCommand(request);
|
|
535
546
|
if (options.json) {
|
|
@@ -569,7 +580,8 @@ async function scrollCommand(direction, pixels, options = {}) {
|
|
|
569
580
|
id: generateId(),
|
|
570
581
|
action: "scroll",
|
|
571
582
|
direction,
|
|
572
|
-
pixels: pixelValue
|
|
583
|
+
pixels: pixelValue,
|
|
584
|
+
tabId: options.tabId
|
|
573
585
|
};
|
|
574
586
|
const response = await sendCommand(request);
|
|
575
587
|
if (options.json) {
|
|
@@ -758,7 +770,8 @@ async function backCommand(options = {}) {
|
|
|
758
770
|
await ensureDaemonRunning();
|
|
759
771
|
const request = {
|
|
760
772
|
id: generateId(),
|
|
761
|
-
action: "back"
|
|
773
|
+
action: "back",
|
|
774
|
+
tabId: options.tabId
|
|
762
775
|
};
|
|
763
776
|
const response = await sendCommand(request);
|
|
764
777
|
if (options.json) {
|
|
@@ -781,7 +794,8 @@ async function forwardCommand(options = {}) {
|
|
|
781
794
|
await ensureDaemonRunning();
|
|
782
795
|
const request = {
|
|
783
796
|
id: generateId(),
|
|
784
|
-
action: "forward"
|
|
797
|
+
action: "forward",
|
|
798
|
+
tabId: options.tabId
|
|
785
799
|
};
|
|
786
800
|
const response = await sendCommand(request);
|
|
787
801
|
if (options.json) {
|
|
@@ -804,7 +818,8 @@ async function refreshCommand(options = {}) {
|
|
|
804
818
|
await ensureDaemonRunning();
|
|
805
819
|
const request = {
|
|
806
820
|
id: generateId(),
|
|
807
|
-
action: "refresh"
|
|
821
|
+
action: "refresh",
|
|
822
|
+
tabId: options.tabId
|
|
808
823
|
};
|
|
809
824
|
const response = await sendCommand(request);
|
|
810
825
|
if (options.json) {
|
|
@@ -837,7 +852,8 @@ async function checkCommand(ref, options = {}) {
|
|
|
837
852
|
const request = {
|
|
838
853
|
id: generateId(),
|
|
839
854
|
action: "check",
|
|
840
|
-
ref: parsedRef
|
|
855
|
+
ref: parsedRef,
|
|
856
|
+
tabId: options.tabId
|
|
841
857
|
};
|
|
842
858
|
const response = await sendCommand(request);
|
|
843
859
|
if (options.json) {
|
|
@@ -875,7 +891,8 @@ async function uncheckCommand(ref, options = {}) {
|
|
|
875
891
|
const request = {
|
|
876
892
|
id: generateId(),
|
|
877
893
|
action: "uncheck",
|
|
878
|
-
ref: parsedRef
|
|
894
|
+
ref: parsedRef,
|
|
895
|
+
tabId: options.tabId
|
|
879
896
|
};
|
|
880
897
|
const response = await sendCommand(request);
|
|
881
898
|
if (options.json) {
|
|
@@ -922,7 +939,8 @@ async function selectCommand(ref, value, options = {}) {
|
|
|
922
939
|
id: generateId(),
|
|
923
940
|
action: "select",
|
|
924
941
|
ref: parsedRef,
|
|
925
|
-
value
|
|
942
|
+
value,
|
|
943
|
+
tabId: options.tabId
|
|
926
944
|
};
|
|
927
945
|
const response = await sendCommand(request);
|
|
928
946
|
if (options.json) {
|
|
@@ -959,7 +977,8 @@ async function evalCommand(script, options = {}) {
|
|
|
959
977
|
const request = {
|
|
960
978
|
id: generateId(),
|
|
961
979
|
action: "eval",
|
|
962
|
-
script
|
|
980
|
+
script,
|
|
981
|
+
tabId: options.tabId
|
|
963
982
|
};
|
|
964
983
|
const response = await sendCommand(request);
|
|
965
984
|
if (options.json) {
|
|
@@ -1094,7 +1113,8 @@ async function frameCommand(selector, options = {}) {
|
|
|
1094
1113
|
const request = {
|
|
1095
1114
|
id: generateId(),
|
|
1096
1115
|
action: "frame",
|
|
1097
|
-
selector
|
|
1116
|
+
selector,
|
|
1117
|
+
tabId: options.tabId
|
|
1098
1118
|
};
|
|
1099
1119
|
const response = await sendCommand(request);
|
|
1100
1120
|
if (options.json) {
|
|
@@ -1117,7 +1137,8 @@ async function frameMainCommand(options = {}) {
|
|
|
1117
1137
|
await ensureDaemonRunning();
|
|
1118
1138
|
const request = {
|
|
1119
1139
|
id: generateId(),
|
|
1120
|
-
action: "frame_main"
|
|
1140
|
+
action: "frame_main",
|
|
1141
|
+
tabId: options.tabId
|
|
1121
1142
|
};
|
|
1122
1143
|
const response = await sendCommand(request);
|
|
1123
1144
|
if (options.json) {
|
|
@@ -1142,7 +1163,8 @@ async function dialogCommand(subCommand, promptText, options = {}) {
|
|
|
1142
1163
|
id: generateId(),
|
|
1143
1164
|
action: "dialog",
|
|
1144
1165
|
dialogResponse: subCommand,
|
|
1145
|
-
promptText: subCommand === "accept" ? promptText : void 0
|
|
1166
|
+
promptText: subCommand === "accept" ? promptText : void 0,
|
|
1167
|
+
tabId: options.tabId
|
|
1146
1168
|
};
|
|
1147
1169
|
const response = await sendCommand(request);
|
|
1148
1170
|
if (options.json) {
|
|
@@ -1174,7 +1196,8 @@ async function networkCommand(subCommand, urlOrFilter, options = {}) {
|
|
|
1174
1196
|
routeOptions: subCommand === "route" ? {
|
|
1175
1197
|
abort: options.abort,
|
|
1176
1198
|
body: options.body
|
|
1177
|
-
} : void 0
|
|
1199
|
+
} : void 0,
|
|
1200
|
+
tabId: options.tabId
|
|
1178
1201
|
});
|
|
1179
1202
|
if (options.json) {
|
|
1180
1203
|
console.log(JSON.stringify(response));
|
|
@@ -1237,7 +1260,8 @@ async function consoleCommand(options = {}) {
|
|
|
1237
1260
|
const response = await sendCommand({
|
|
1238
1261
|
id: crypto.randomUUID(),
|
|
1239
1262
|
action: "console",
|
|
1240
|
-
consoleCommand: options.clear ? "clear" : "get"
|
|
1263
|
+
consoleCommand: options.clear ? "clear" : "get",
|
|
1264
|
+
tabId: options.tabId
|
|
1241
1265
|
});
|
|
1242
1266
|
if (options.json) {
|
|
1243
1267
|
console.log(JSON.stringify(response));
|
|
@@ -1281,7 +1305,8 @@ async function errorsCommand(options = {}) {
|
|
|
1281
1305
|
const response = await sendCommand({
|
|
1282
1306
|
id: crypto.randomUUID(),
|
|
1283
1307
|
action: "errors",
|
|
1284
|
-
errorsCommand: options.clear ? "clear" : "get"
|
|
1308
|
+
errorsCommand: options.clear ? "clear" : "get",
|
|
1309
|
+
tabId: options.tabId
|
|
1285
1310
|
});
|
|
1286
1311
|
if (options.json) {
|
|
1287
1312
|
console.log(JSON.stringify(response));
|
|
@@ -1320,7 +1345,8 @@ async function traceCommand(subCommand, options = {}) {
|
|
|
1320
1345
|
const response = await sendCommand({
|
|
1321
1346
|
id: crypto.randomUUID(),
|
|
1322
1347
|
action: "trace",
|
|
1323
|
-
traceCommand: subCommand
|
|
1348
|
+
traceCommand: subCommand,
|
|
1349
|
+
tabId: options.tabId
|
|
1324
1350
|
});
|
|
1325
1351
|
if (options.json) {
|
|
1326
1352
|
console.log(JSON.stringify(response));
|
|
@@ -1396,7 +1422,7 @@ async function traceCommand(subCommand, options = {}) {
|
|
|
1396
1422
|
}
|
|
1397
1423
|
|
|
1398
1424
|
// packages/cli/src/index.ts
|
|
1399
|
-
var VERSION = "0.1.
|
|
1425
|
+
var VERSION = "0.1.2";
|
|
1400
1426
|
var HELP_TEXT = `
|
|
1401
1427
|
bb-browser - AI Agent \u6D4F\u89C8\u5668\u81EA\u52A8\u5316\u5DE5\u5177
|
|
1402
1428
|
|
|
@@ -1455,6 +1481,7 @@ bb-browser - AI Agent \u6D4F\u89C8\u5668\u81EA\u52A8\u5316\u5DE5\u5177
|
|
|
1455
1481
|
\u9009\u9879\uFF1A
|
|
1456
1482
|
--json \u4EE5 JSON \u683C\u5F0F\u8F93\u51FA
|
|
1457
1483
|
-i, --interactive \u53EA\u8F93\u51FA\u53EF\u4EA4\u4E92\u5143\u7D20\uFF08snapshot \u547D\u4EE4\uFF09
|
|
1484
|
+
--tab <tabId> \u6307\u5B9A\u64CD\u4F5C\u7684\u6807\u7B7E\u9875 ID
|
|
1458
1485
|
--help, -h \u663E\u793A\u5E2E\u52A9\u4FE1\u606F
|
|
1459
1486
|
--version, -v \u663E\u793A\u7248\u672C\u53F7
|
|
1460
1487
|
|
|
@@ -1499,6 +1526,8 @@ function parseArgs(argv) {
|
|
|
1499
1526
|
result.flags.interactive = true;
|
|
1500
1527
|
} else if (arg === "--id") {
|
|
1501
1528
|
skipNext = true;
|
|
1529
|
+
} else if (arg === "--tab" && !result.command) {
|
|
1530
|
+
skipNext = true;
|
|
1502
1531
|
} else if (arg.startsWith("-")) {
|
|
1503
1532
|
} else if (result.command === null) {
|
|
1504
1533
|
result.command = arg;
|
|
@@ -1510,6 +1539,8 @@ function parseArgs(argv) {
|
|
|
1510
1539
|
}
|
|
1511
1540
|
async function main() {
|
|
1512
1541
|
const parsed = parseArgs(process.argv);
|
|
1542
|
+
const tabArgIdx = process.argv.indexOf("--tab");
|
|
1543
|
+
const globalTabId = tabArgIdx >= 0 && process.argv[tabArgIdx + 1] ? parseInt(process.argv[tabArgIdx + 1], 10) : void 0;
|
|
1513
1544
|
if (parsed.flags.version) {
|
|
1514
1545
|
console.log(VERSION);
|
|
1515
1546
|
return;
|
|
@@ -1533,7 +1564,7 @@ async function main() {
|
|
|
1533
1564
|
break;
|
|
1534
1565
|
}
|
|
1535
1566
|
case "snapshot": {
|
|
1536
|
-
await snapshotCommand({ json: parsed.flags.json, interactive: parsed.flags.interactive });
|
|
1567
|
+
await snapshotCommand({ json: parsed.flags.json, interactive: parsed.flags.interactive, tabId: globalTabId });
|
|
1537
1568
|
break;
|
|
1538
1569
|
}
|
|
1539
1570
|
case "click": {
|
|
@@ -1544,7 +1575,7 @@ async function main() {
|
|
|
1544
1575
|
console.error("\u793A\u4F8B\uFF1Abb-browser click @5");
|
|
1545
1576
|
process.exit(1);
|
|
1546
1577
|
}
|
|
1547
|
-
await clickCommand(ref, { json: parsed.flags.json });
|
|
1578
|
+
await clickCommand(ref, { json: parsed.flags.json, tabId: globalTabId });
|
|
1548
1579
|
break;
|
|
1549
1580
|
}
|
|
1550
1581
|
case "hover": {
|
|
@@ -1555,7 +1586,7 @@ async function main() {
|
|
|
1555
1586
|
console.error("\u793A\u4F8B\uFF1Abb-browser hover @5");
|
|
1556
1587
|
process.exit(1);
|
|
1557
1588
|
}
|
|
1558
|
-
await hoverCommand(ref, { json: parsed.flags.json });
|
|
1589
|
+
await hoverCommand(ref, { json: parsed.flags.json, tabId: globalTabId });
|
|
1559
1590
|
break;
|
|
1560
1591
|
}
|
|
1561
1592
|
case "check": {
|
|
@@ -1566,7 +1597,7 @@ async function main() {
|
|
|
1566
1597
|
console.error("\u793A\u4F8B\uFF1Abb-browser check @5");
|
|
1567
1598
|
process.exit(1);
|
|
1568
1599
|
}
|
|
1569
|
-
await checkCommand(ref, { json: parsed.flags.json });
|
|
1600
|
+
await checkCommand(ref, { json: parsed.flags.json, tabId: globalTabId });
|
|
1570
1601
|
break;
|
|
1571
1602
|
}
|
|
1572
1603
|
case "uncheck": {
|
|
@@ -1577,7 +1608,7 @@ async function main() {
|
|
|
1577
1608
|
console.error("\u793A\u4F8B\uFF1Abb-browser uncheck @5");
|
|
1578
1609
|
process.exit(1);
|
|
1579
1610
|
}
|
|
1580
|
-
await uncheckCommand(ref, { json: parsed.flags.json });
|
|
1611
|
+
await uncheckCommand(ref, { json: parsed.flags.json, tabId: globalTabId });
|
|
1581
1612
|
break;
|
|
1582
1613
|
}
|
|
1583
1614
|
case "fill": {
|
|
@@ -1595,7 +1626,7 @@ async function main() {
|
|
|
1595
1626
|
console.error('\u793A\u4F8B\uFF1Abb-browser fill @3 "hello world"');
|
|
1596
1627
|
process.exit(1);
|
|
1597
1628
|
}
|
|
1598
|
-
await fillCommand(ref, text, { json: parsed.flags.json });
|
|
1629
|
+
await fillCommand(ref, text, { json: parsed.flags.json, tabId: globalTabId });
|
|
1599
1630
|
break;
|
|
1600
1631
|
}
|
|
1601
1632
|
case "type": {
|
|
@@ -1613,7 +1644,7 @@ async function main() {
|
|
|
1613
1644
|
console.error('\u793A\u4F8B\uFF1Abb-browser type @3 "append text"');
|
|
1614
1645
|
process.exit(1);
|
|
1615
1646
|
}
|
|
1616
|
-
await typeCommand(ref, text, { json: parsed.flags.json });
|
|
1647
|
+
await typeCommand(ref, text, { json: parsed.flags.json, tabId: globalTabId });
|
|
1617
1648
|
break;
|
|
1618
1649
|
}
|
|
1619
1650
|
case "select": {
|
|
@@ -1631,7 +1662,7 @@ async function main() {
|
|
|
1631
1662
|
console.error('\u793A\u4F8B\uFF1Abb-browser select @4 "option1"');
|
|
1632
1663
|
process.exit(1);
|
|
1633
1664
|
}
|
|
1634
|
-
await selectCommand(ref, value, { json: parsed.flags.json });
|
|
1665
|
+
await selectCommand(ref, value, { json: parsed.flags.json, tabId: globalTabId });
|
|
1635
1666
|
break;
|
|
1636
1667
|
}
|
|
1637
1668
|
case "eval": {
|
|
@@ -1642,7 +1673,7 @@ async function main() {
|
|
|
1642
1673
|
console.error('\u793A\u4F8B\uFF1Abb-browser eval "document.title"');
|
|
1643
1674
|
process.exit(1);
|
|
1644
1675
|
}
|
|
1645
|
-
await evalCommand(script, { json: parsed.flags.json });
|
|
1676
|
+
await evalCommand(script, { json: parsed.flags.json, tabId: globalTabId });
|
|
1646
1677
|
break;
|
|
1647
1678
|
}
|
|
1648
1679
|
case "get": {
|
|
@@ -1660,7 +1691,7 @@ async function main() {
|
|
|
1660
1691
|
process.exit(1);
|
|
1661
1692
|
}
|
|
1662
1693
|
const ref = parsed.args[1];
|
|
1663
|
-
await getCommand(attribute, ref, { json: parsed.flags.json });
|
|
1694
|
+
await getCommand(attribute, ref, { json: parsed.flags.json, tabId: globalTabId });
|
|
1664
1695
|
break;
|
|
1665
1696
|
}
|
|
1666
1697
|
case "daemon":
|
|
@@ -1681,24 +1712,24 @@ async function main() {
|
|
|
1681
1712
|
break;
|
|
1682
1713
|
}
|
|
1683
1714
|
case "close": {
|
|
1684
|
-
await closeCommand({ json: parsed.flags.json });
|
|
1715
|
+
await closeCommand({ json: parsed.flags.json, tabId: globalTabId });
|
|
1685
1716
|
break;
|
|
1686
1717
|
}
|
|
1687
1718
|
case "back": {
|
|
1688
|
-
await backCommand({ json: parsed.flags.json });
|
|
1719
|
+
await backCommand({ json: parsed.flags.json, tabId: globalTabId });
|
|
1689
1720
|
break;
|
|
1690
1721
|
}
|
|
1691
1722
|
case "forward": {
|
|
1692
|
-
await forwardCommand({ json: parsed.flags.json });
|
|
1723
|
+
await forwardCommand({ json: parsed.flags.json, tabId: globalTabId });
|
|
1693
1724
|
break;
|
|
1694
1725
|
}
|
|
1695
1726
|
case "refresh": {
|
|
1696
|
-
await refreshCommand({ json: parsed.flags.json });
|
|
1727
|
+
await refreshCommand({ json: parsed.flags.json, tabId: globalTabId });
|
|
1697
1728
|
break;
|
|
1698
1729
|
}
|
|
1699
1730
|
case "screenshot": {
|
|
1700
1731
|
const outputPath = parsed.args[0];
|
|
1701
|
-
await screenshotCommand(outputPath, { json: parsed.flags.json });
|
|
1732
|
+
await screenshotCommand(outputPath, { json: parsed.flags.json, tabId: globalTabId });
|
|
1702
1733
|
break;
|
|
1703
1734
|
}
|
|
1704
1735
|
case "wait": {
|
|
@@ -1710,7 +1741,7 @@ async function main() {
|
|
|
1710
1741
|
console.error(" bb-browser wait @5");
|
|
1711
1742
|
process.exit(1);
|
|
1712
1743
|
}
|
|
1713
|
-
await waitCommand(target, { json: parsed.flags.json });
|
|
1744
|
+
await waitCommand(target, { json: parsed.flags.json, tabId: globalTabId });
|
|
1714
1745
|
break;
|
|
1715
1746
|
}
|
|
1716
1747
|
case "press": {
|
|
@@ -1722,7 +1753,7 @@ async function main() {
|
|
|
1722
1753
|
console.error(" bb-browser press Control+a");
|
|
1723
1754
|
process.exit(1);
|
|
1724
1755
|
}
|
|
1725
|
-
await pressCommand(key, { json: parsed.flags.json });
|
|
1756
|
+
await pressCommand(key, { json: parsed.flags.json, tabId: globalTabId });
|
|
1726
1757
|
break;
|
|
1727
1758
|
}
|
|
1728
1759
|
case "scroll": {
|
|
@@ -1735,7 +1766,7 @@ async function main() {
|
|
|
1735
1766
|
console.error(" bb-browser scroll up 500");
|
|
1736
1767
|
process.exit(1);
|
|
1737
1768
|
}
|
|
1738
|
-
await scrollCommand(direction, pixels, { json: parsed.flags.json });
|
|
1769
|
+
await scrollCommand(direction, pixels, { json: parsed.flags.json, tabId: globalTabId });
|
|
1739
1770
|
break;
|
|
1740
1771
|
}
|
|
1741
1772
|
case "tab": {
|
|
@@ -1752,9 +1783,9 @@ async function main() {
|
|
|
1752
1783
|
process.exit(1);
|
|
1753
1784
|
}
|
|
1754
1785
|
if (selectorOrMain === "main") {
|
|
1755
|
-
await frameMainCommand({ json: parsed.flags.json });
|
|
1786
|
+
await frameMainCommand({ json: parsed.flags.json, tabId: globalTabId });
|
|
1756
1787
|
} else {
|
|
1757
|
-
await frameCommand(selectorOrMain, { json: parsed.flags.json });
|
|
1788
|
+
await frameCommand(selectorOrMain, { json: parsed.flags.json, tabId: globalTabId });
|
|
1758
1789
|
}
|
|
1759
1790
|
break;
|
|
1760
1791
|
}
|
|
@@ -1769,7 +1800,7 @@ async function main() {
|
|
|
1769
1800
|
process.exit(1);
|
|
1770
1801
|
}
|
|
1771
1802
|
const promptText = parsed.args[1];
|
|
1772
|
-
await dialogCommand(subCommand, promptText, { json: parsed.flags.json });
|
|
1803
|
+
await dialogCommand(subCommand, promptText, { json: parsed.flags.json, tabId: globalTabId });
|
|
1773
1804
|
break;
|
|
1774
1805
|
}
|
|
1775
1806
|
case "network": {
|
|
@@ -1778,17 +1809,17 @@ async function main() {
|
|
|
1778
1809
|
const abort = process.argv.includes("--abort");
|
|
1779
1810
|
const bodyIndex = process.argv.findIndex((a) => a === "--body");
|
|
1780
1811
|
const body = bodyIndex >= 0 ? process.argv[bodyIndex + 1] : void 0;
|
|
1781
|
-
await networkCommand(subCommand, urlOrFilter, { json: parsed.flags.json, abort, body });
|
|
1812
|
+
await networkCommand(subCommand, urlOrFilter, { json: parsed.flags.json, abort, body, tabId: globalTabId });
|
|
1782
1813
|
break;
|
|
1783
1814
|
}
|
|
1784
1815
|
case "console": {
|
|
1785
1816
|
const clear = process.argv.includes("--clear");
|
|
1786
|
-
await consoleCommand({ json: parsed.flags.json, clear });
|
|
1817
|
+
await consoleCommand({ json: parsed.flags.json, clear, tabId: globalTabId });
|
|
1787
1818
|
break;
|
|
1788
1819
|
}
|
|
1789
1820
|
case "errors": {
|
|
1790
1821
|
const clear = process.argv.includes("--clear");
|
|
1791
|
-
await errorsCommand({ json: parsed.flags.json, clear });
|
|
1822
|
+
await errorsCommand({ json: parsed.flags.json, clear, tabId: globalTabId });
|
|
1792
1823
|
break;
|
|
1793
1824
|
}
|
|
1794
1825
|
case "trace": {
|
|
@@ -1801,7 +1832,7 @@ async function main() {
|
|
|
1801
1832
|
console.error(" bb-browser trace status");
|
|
1802
1833
|
process.exit(1);
|
|
1803
1834
|
}
|
|
1804
|
-
await traceCommand(subCmd, { json: parsed.flags.json });
|
|
1835
|
+
await traceCommand(subCmd, { json: parsed.flags.json, tabId: globalTabId });
|
|
1805
1836
|
break;
|
|
1806
1837
|
}
|
|
1807
1838
|
default: {
|