@browserbasehq/browse-cli 0.5.0-alpha-666baf1 → 0.5.0-alpha-34598b9
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/index.js +17 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -165541,6 +165541,13 @@ async function executeCommand(context, command, args, stagehand) {
|
|
|
165541
165541
|
await stagehand.act(action);
|
|
165542
165542
|
return { selected: values };
|
|
165543
165543
|
}
|
|
165544
|
+
case "upload": {
|
|
165545
|
+
const [selector, filePaths] = args;
|
|
165546
|
+
const resolved = resolveSelector(selector);
|
|
165547
|
+
const files = filePaths.length === 1 ? filePaths[0] : filePaths;
|
|
165548
|
+
await page.deepLocator(resolved).setInputFiles(files);
|
|
165549
|
+
return { uploaded: true, files: filePaths };
|
|
165550
|
+
}
|
|
165544
165551
|
case "highlight": {
|
|
165545
165552
|
const [selector, duration3] = args;
|
|
165546
165553
|
await page.deepLocator(resolveSelector(selector)).highlight({ durationMs: duration3 ?? 2e3 });
|
|
@@ -166584,6 +166591,16 @@ program.command("select <selector> <values...>").description("Select option(s)")
|
|
|
166584
166591
|
process.exit(1);
|
|
166585
166592
|
}
|
|
166586
166593
|
});
|
|
166594
|
+
program.command("upload <selector> <files...>").description('Upload file(s) to an <input type="file"> element').action(async (selector, files) => {
|
|
166595
|
+
const opts = program.opts();
|
|
166596
|
+
try {
|
|
166597
|
+
const result = await runCommand("upload", [selector, files]);
|
|
166598
|
+
output(result, opts.json ?? false);
|
|
166599
|
+
} catch (e3) {
|
|
166600
|
+
console.error("Error:", e3 instanceof Error ? e3.message : e3);
|
|
166601
|
+
process.exit(1);
|
|
166602
|
+
}
|
|
166603
|
+
});
|
|
166587
166604
|
program.command("highlight <selector>").description("Highlight element").option("-d, --duration <ms>", "Duration", "2000").action(async (selector, cmdOpts) => {
|
|
166588
166605
|
const opts = program.opts();
|
|
166589
166606
|
try {
|