browser-pilot 0.0.10 → 0.0.11
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/actions.cjs +16 -7
- package/dist/actions.d.cts +2 -2
- package/dist/actions.d.ts +2 -2
- package/dist/actions.mjs +1 -1
- package/dist/browser.cjs +1619 -303
- package/dist/browser.d.cts +22 -5
- package/dist/browser.d.ts +22 -5
- package/dist/browser.mjs +3 -3
- package/dist/{chunk-R3PS4PCM.mjs → chunk-BRAFQUMG.mjs} +34 -12
- package/dist/{chunk-KKW2SZLV.mjs → chunk-FAUNIZR7.mjs} +18 -8
- package/dist/{chunk-7OSR2CAE.mjs → chunk-JHAF52FA.mjs} +1611 -301
- package/dist/cli.mjs +1988 -345
- package/dist/index.cjs +1669 -327
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.mjs +3 -3
- package/dist/providers.cjs +34 -12
- package/dist/providers.mjs +1 -1
- package/dist/{types-DOGsEYQa.d.ts → types-DtGF3yGl.d.ts} +39 -11
- package/dist/{types-CYw-7vx1.d.cts → types-GWuQJs_e.d.cts} +39 -11
- package/package.json +1 -1
package/dist/actions.cjs
CHANGED
|
@@ -32,7 +32,12 @@ var ElementNotFoundError = class extends Error {
|
|
|
32
32
|
hints;
|
|
33
33
|
constructor(selectors, hints) {
|
|
34
34
|
const selectorList = Array.isArray(selectors) ? selectors : [selectors];
|
|
35
|
-
|
|
35
|
+
let msg = `Element not found: ${selectorList.join(", ")}`;
|
|
36
|
+
if (hints?.length) {
|
|
37
|
+
msg += `. Did you mean: ${hints.slice(0, 3).map((h) => `${h.element.ref} (${h.element.role} "${h.element.name}")`).join(", ")}`;
|
|
38
|
+
}
|
|
39
|
+
msg += `. Run 'bp snapshot' to see available elements.`;
|
|
40
|
+
super(msg);
|
|
36
41
|
this.name = "ElementNotFoundError";
|
|
37
42
|
this.selectors = selectorList;
|
|
38
43
|
this.hints = hints;
|
|
@@ -111,7 +116,7 @@ var BatchExecutor = class {
|
|
|
111
116
|
}
|
|
112
117
|
case "click": {
|
|
113
118
|
if (!step.selector) throw new Error("click requires selector");
|
|
114
|
-
if (step.waitForNavigation) {
|
|
119
|
+
if (step.waitForNavigation === true) {
|
|
115
120
|
const navPromise = this.page.waitForNavigation({ timeout, optional });
|
|
116
121
|
await this.page.click(step.selector, { timeout, optional });
|
|
117
122
|
await navPromise;
|
|
@@ -126,7 +131,6 @@ var BatchExecutor = class {
|
|
|
126
131
|
await this.page.fill(step.selector, step.value, {
|
|
127
132
|
timeout,
|
|
128
133
|
optional,
|
|
129
|
-
clear: step.clear ?? true,
|
|
130
134
|
blur: step.blur
|
|
131
135
|
});
|
|
132
136
|
return { selectorUsed: this.getUsedSelector(step.selector) };
|
|
@@ -174,7 +178,8 @@ var BatchExecutor = class {
|
|
|
174
178
|
await this.page.submit(step.selector, {
|
|
175
179
|
timeout,
|
|
176
180
|
optional,
|
|
177
|
-
method: step.method ?? "enter+click"
|
|
181
|
+
method: step.method ?? "enter+click",
|
|
182
|
+
waitForNavigation: step.waitForNavigation
|
|
178
183
|
});
|
|
179
184
|
return { selectorUsed: this.getUsedSelector(step.selector) };
|
|
180
185
|
}
|
|
@@ -396,7 +401,6 @@ var ACTION_RULES = {
|
|
|
396
401
|
fill: {
|
|
397
402
|
required: { selector: { type: "string|string[]" }, value: { type: "string" } },
|
|
398
403
|
optional: {
|
|
399
|
-
clear: { type: "boolean" },
|
|
400
404
|
blur: { type: "boolean" }
|
|
401
405
|
}
|
|
402
406
|
},
|
|
@@ -427,7 +431,8 @@ var ACTION_RULES = {
|
|
|
427
431
|
submit: {
|
|
428
432
|
required: { selector: { type: "string|string[]" } },
|
|
429
433
|
optional: {
|
|
430
|
-
method: { type: "string", enum: ["enter", "click", "enter+click"] }
|
|
434
|
+
method: { type: "string", enum: ["enter", "click", "enter+click"] },
|
|
435
|
+
waitForNavigation: { type: "boolean|auto" }
|
|
431
436
|
}
|
|
432
437
|
},
|
|
433
438
|
press: {
|
|
@@ -505,7 +510,6 @@ var KNOWN_STEP_FIELDS = /* @__PURE__ */ new Set([
|
|
|
505
510
|
"timeout",
|
|
506
511
|
"optional",
|
|
507
512
|
"method",
|
|
508
|
-
"clear",
|
|
509
513
|
"blur",
|
|
510
514
|
"delay",
|
|
511
515
|
"waitForNavigation",
|
|
@@ -586,6 +590,11 @@ function checkFieldType(value, rule) {
|
|
|
586
590
|
case "boolean":
|
|
587
591
|
if (typeof value !== "boolean") return `expected boolean, got ${typeof value}`;
|
|
588
592
|
return null;
|
|
593
|
+
case "boolean|auto":
|
|
594
|
+
if (typeof value !== "boolean" && value !== "auto") {
|
|
595
|
+
return `expected boolean or "auto", got ${typeof value}`;
|
|
596
|
+
}
|
|
597
|
+
return null;
|
|
589
598
|
}
|
|
590
599
|
}
|
|
591
600
|
function validateSteps(steps) {
|
package/dist/actions.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { y as Page, S as Step, B as BatchOptions, b as BatchResult } from './types-
|
|
2
|
-
export { A as ActionType, c as StepResult } from './types-
|
|
1
|
+
import { y as Page, S as Step, B as BatchOptions, b as BatchResult } from './types-GWuQJs_e.cjs';
|
|
2
|
+
export { A as ActionType, c as StepResult } from './types-GWuQJs_e.cjs';
|
|
3
3
|
import './client-7Nqka5MV.cjs';
|
|
4
4
|
|
|
5
5
|
/**
|
package/dist/actions.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { y as Page, S as Step, B as BatchOptions, b as BatchResult } from './types-
|
|
2
|
-
export { A as ActionType, c as StepResult } from './types-
|
|
1
|
+
import { y as Page, S as Step, B as BatchOptions, b as BatchResult } from './types-DtGF3yGl.js';
|
|
2
|
+
export { A as ActionType, c as StepResult } from './types-DtGF3yGl.js';
|
|
3
3
|
import './client-7Nqka5MV.js';
|
|
4
4
|
|
|
5
5
|
/**
|