@pi-oxide/extension-js 0.10.3 → 0.11.1
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/content-script.js +3 -2
- package/extension_js.d.ts +45 -48
- package/extension_js.js +17164 -64615
- package/index.js +10 -7
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -201,14 +201,14 @@ function ve(e) {
|
|
|
201
201
|
const r = new Error(e.message);
|
|
202
202
|
throw r.code = e.code, e.category && (r.category = e.category), e.hint && (r.hint = e.hint), e.recovery && (r.recovery = e.recovery), e.details && (r.details = e.details), r;
|
|
203
203
|
}
|
|
204
|
-
function sr(e, r) {
|
|
205
|
-
let
|
|
206
|
-
if (r
|
|
207
|
-
const
|
|
208
|
-
|
|
204
|
+
function sr(e, r, n) {
|
|
205
|
+
let a = `Element not found by label "${e}"`;
|
|
206
|
+
if (r !== void 0) {
|
|
207
|
+
const i = r.map((s) => s.name || s.refId).filter(Boolean).slice(0, 5);
|
|
208
|
+
a += i.length > 0 ? `. Candidates: ${i.join(", ")}` : ". Candidates: none";
|
|
209
209
|
}
|
|
210
210
|
return {
|
|
211
|
-
message:
|
|
211
|
+
message: a,
|
|
212
212
|
code: "E_NOT_FOUND",
|
|
213
213
|
category: "resource",
|
|
214
214
|
hint: "No element matched this label. Check candidates or snapshot for visible controls.",
|
|
@@ -216,7 +216,10 @@ function sr(e, r) {
|
|
|
216
216
|
"const d = await page.snapshot_data(); find the target in d.nodes",
|
|
217
217
|
"Try a more specific label or use refId from snapshot"
|
|
218
218
|
],
|
|
219
|
-
details:
|
|
219
|
+
details: {
|
|
220
|
+
label: e,
|
|
221
|
+
...r != null && r.length ? { candidates: r } : {}
|
|
222
|
+
}
|
|
220
223
|
};
|
|
221
224
|
}
|
|
222
225
|
function cr(e) {
|