@xpert-ai/chatkit-host-automation 0.3.4 → 0.3.5
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.d.ts +505 -0
- package/dist/index.js +683 -387
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const
|
|
1
|
+
const it = [
|
|
2
2
|
"host_page_snapshot",
|
|
3
3
|
"host_page_click",
|
|
4
4
|
"host_page_fill",
|
|
@@ -11,9 +11,9 @@ const tt = [
|
|
|
11
11
|
"host_page_pointer",
|
|
12
12
|
"host_page_screenshot",
|
|
13
13
|
"host_page_wait_for"
|
|
14
|
-
],
|
|
15
|
-
|
|
16
|
-
),
|
|
14
|
+
], rt = new Set(
|
|
15
|
+
it
|
|
16
|
+
), st = [
|
|
17
17
|
"a[href]",
|
|
18
18
|
"button",
|
|
19
19
|
"input",
|
|
@@ -28,17 +28,17 @@ const tt = [
|
|
|
28
28
|
"[data-testid]",
|
|
29
29
|
"[data-test-id]",
|
|
30
30
|
"[data-qa]"
|
|
31
|
-
].join(","),
|
|
32
|
-
function
|
|
33
|
-
return
|
|
31
|
+
].join(","), X = 100, at = 1e4, ct = 6e4;
|
|
32
|
+
function lt(t) {
|
|
33
|
+
return rt.has(t);
|
|
34
34
|
}
|
|
35
|
-
function
|
|
35
|
+
function T(t) {
|
|
36
36
|
return t instanceof Document ? t : t.ownerDocument;
|
|
37
37
|
}
|
|
38
|
-
function
|
|
39
|
-
return
|
|
38
|
+
function N(t) {
|
|
39
|
+
return T(t).defaultView ?? window;
|
|
40
40
|
}
|
|
41
|
-
function
|
|
41
|
+
function m(t) {
|
|
42
42
|
return typeof t == "object" && t !== null && !Array.isArray(t) ? t : {};
|
|
43
43
|
}
|
|
44
44
|
function O(t, e) {
|
|
@@ -46,24 +46,38 @@ function O(t, e) {
|
|
|
46
46
|
throw new Error(`${e} must be a non-empty string.`);
|
|
47
47
|
return t;
|
|
48
48
|
}
|
|
49
|
-
function
|
|
49
|
+
function x(t) {
|
|
50
50
|
return typeof t == "string" && t.trim() ? t : void 0;
|
|
51
51
|
}
|
|
52
|
-
function
|
|
52
|
+
function ut(t) {
|
|
53
|
+
return t === "viewport_normalized" ? "viewport_normalized" : "viewport-css-px";
|
|
54
|
+
}
|
|
55
|
+
function U(t, e) {
|
|
56
|
+
const n = z(e.x, "x"), o = z(e.y, "y");
|
|
57
|
+
if (ut(e.coordinateSpace) === "viewport_normalized") {
|
|
58
|
+
const i = N(t);
|
|
59
|
+
return {
|
|
60
|
+
x: Number((n * i.innerWidth).toFixed(3)),
|
|
61
|
+
y: Number((o * i.innerHeight).toFixed(3))
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
return { x: n, y: o };
|
|
65
|
+
}
|
|
66
|
+
function dt(t) {
|
|
53
67
|
return typeof t == "number" && Number.isInteger(t) ? t : void 0;
|
|
54
68
|
}
|
|
55
|
-
function
|
|
69
|
+
function z(t, e) {
|
|
56
70
|
if (typeof t != "number" || !Number.isFinite(t))
|
|
57
71
|
throw new Error(`${e} must be a finite number.`);
|
|
58
72
|
return t;
|
|
59
73
|
}
|
|
60
|
-
function
|
|
74
|
+
function k(t) {
|
|
61
75
|
return typeof t == "number" && Number.isFinite(t) ? t : void 0;
|
|
62
76
|
}
|
|
63
|
-
function
|
|
77
|
+
function Y(t, e) {
|
|
64
78
|
return typeof t == "string" && e.includes(t) ? t : void 0;
|
|
65
79
|
}
|
|
66
|
-
function
|
|
80
|
+
function ft(t) {
|
|
67
81
|
if (typeof t == "string")
|
|
68
82
|
return [t];
|
|
69
83
|
if (Array.isArray(t) && t.every((e) => typeof e == "string"))
|
|
@@ -74,50 +88,50 @@ function b(t) {
|
|
|
74
88
|
const e = (t.textContent ?? "").replace(/\s+/g, " ").trim();
|
|
75
89
|
return e ? e.slice(0, 160) : void 0;
|
|
76
90
|
}
|
|
77
|
-
function
|
|
91
|
+
function P(t) {
|
|
78
92
|
const e = Array.from(t.childNodes).filter((n) => n.nodeType === Node.TEXT_NODE).map((n) => n.textContent ?? "").join(" ").replace(/\s+/g, " ").trim();
|
|
79
93
|
return e ? e.slice(0, 160) : void 0;
|
|
80
94
|
}
|
|
81
|
-
function
|
|
95
|
+
function F(t) {
|
|
82
96
|
if (t instanceof HTMLInputElement || t instanceof HTMLTextAreaElement || t instanceof HTMLSelectElement)
|
|
83
97
|
return t.value;
|
|
84
98
|
}
|
|
85
|
-
function
|
|
99
|
+
function Q(t) {
|
|
86
100
|
return t instanceof HTMLInputElement && (t.type === "checkbox" || t.type === "radio");
|
|
87
101
|
}
|
|
88
|
-
function
|
|
102
|
+
function pt(t) {
|
|
89
103
|
return t instanceof HTMLInputElement || t instanceof HTMLSelectElement || t instanceof HTMLTextAreaElement ? Array.from(t.labels ?? []) : [];
|
|
90
104
|
}
|
|
91
|
-
function
|
|
105
|
+
function ht(t, e) {
|
|
92
106
|
var o;
|
|
93
|
-
return (((o = t.getAttribute(e)) == null ? void 0 : o.trim().split(/\s+/)) ?? []).map((
|
|
107
|
+
return (((o = t.getAttribute(e)) == null ? void 0 : o.trim().split(/\s+/)) ?? []).map((i) => t.ownerDocument.getElementById(i)).filter((i) => !!i).map((i) => b(i)).filter((i) => !!i);
|
|
94
108
|
}
|
|
95
|
-
function
|
|
96
|
-
const e =
|
|
109
|
+
function gt(t) {
|
|
110
|
+
const e = ht(t, "aria-labelledby");
|
|
97
111
|
if (e.length > 0)
|
|
98
112
|
return e.join(" ").slice(0, 160);
|
|
99
|
-
const n =
|
|
113
|
+
const n = pt(t).map((o) => b(o)).filter((o) => !!o);
|
|
100
114
|
if (n.length > 0)
|
|
101
115
|
return n.join(" ").slice(0, 160);
|
|
102
116
|
}
|
|
103
|
-
function
|
|
117
|
+
function bt(t) {
|
|
104
118
|
const e = [];
|
|
105
119
|
let n = t.nextSibling;
|
|
106
120
|
for (; n; ) {
|
|
107
121
|
if (n.nodeType === Node.TEXT_NODE) {
|
|
108
|
-
const
|
|
109
|
-
|
|
122
|
+
const i = (n.textContent ?? "").replace(/\s+/g, " ").trim();
|
|
123
|
+
i && e.push(i);
|
|
110
124
|
} else {
|
|
111
125
|
if (n.nodeType === Node.ELEMENT_NODE && n.tagName.toLowerCase() === "br")
|
|
112
126
|
break;
|
|
113
127
|
if (n.nodeType === Node.ELEMENT_NODE) {
|
|
114
|
-
const
|
|
115
|
-
if (
|
|
128
|
+
const i = n;
|
|
129
|
+
if (i.matches(
|
|
116
130
|
'input,textarea,select,button,a[href],[role="button"],[role="link"]'
|
|
117
131
|
))
|
|
118
132
|
break;
|
|
119
|
-
const
|
|
120
|
-
|
|
133
|
+
const s = b(i);
|
|
134
|
+
s && e.push(s);
|
|
121
135
|
break;
|
|
122
136
|
}
|
|
123
137
|
}
|
|
@@ -128,94 +142,94 @@ function dt(t) {
|
|
|
128
142
|
const o = e.join(" ").replace(/\s+/g, " ").trim();
|
|
129
143
|
return o ? o.slice(0, 160) : void 0;
|
|
130
144
|
}
|
|
131
|
-
function
|
|
145
|
+
function G(t, e) {
|
|
132
146
|
var d;
|
|
133
147
|
const n = t.ownerDocument, o = n.body;
|
|
134
148
|
if (!o)
|
|
135
149
|
return;
|
|
136
|
-
const
|
|
137
|
-
if (
|
|
150
|
+
const i = t.getBoundingClientRect();
|
|
151
|
+
if (i.width <= 0 || i.height <= 0)
|
|
138
152
|
return;
|
|
139
|
-
const
|
|
140
|
-
let
|
|
141
|
-
for (;
|
|
142
|
-
const
|
|
143
|
-
if (
|
|
144
|
-
const
|
|
153
|
+
const s = i.top + i.height / 2, r = [], a = n.createTreeWalker(o, NodeFilter.SHOW_ELEMENT);
|
|
154
|
+
let c = a.nextNode();
|
|
155
|
+
for (; c; ) {
|
|
156
|
+
const u = c;
|
|
157
|
+
if (u !== t && !u.contains(t) && j(u)) {
|
|
158
|
+
const l = u.getBoundingClientRect(), f = P(u) ?? b(u);
|
|
145
159
|
if (f) {
|
|
146
|
-
const
|
|
147
|
-
|
|
160
|
+
const p = l.top + l.height / 2, y = Math.abs(p - s) <= Math.max(28, i.height * 1.25), h = e === "left" ? i.left - l.right : l.left - i.right;
|
|
161
|
+
y && h >= -8 && h <= 240 && r.push({
|
|
148
162
|
text: f,
|
|
149
|
-
score: Math.abs(
|
|
163
|
+
score: Math.abs(h) + Math.abs(p - s)
|
|
150
164
|
});
|
|
151
165
|
}
|
|
152
166
|
}
|
|
153
|
-
|
|
167
|
+
c = a.nextNode();
|
|
154
168
|
}
|
|
155
|
-
return (d =
|
|
169
|
+
return (d = r.sort((u, l) => u.score - l.score)[0]) == null ? void 0 : d.text;
|
|
156
170
|
}
|
|
157
|
-
function
|
|
171
|
+
function H(t) {
|
|
158
172
|
if (!(t instanceof HTMLInputElement || t instanceof HTMLSelectElement || t instanceof HTMLTextAreaElement))
|
|
159
173
|
return;
|
|
160
|
-
const e =
|
|
161
|
-
return e || (
|
|
174
|
+
const e = gt(t);
|
|
175
|
+
return e || (Q(t) ? G(t, "right") ?? bt(t) ?? C(t)[0] : G(t, "left") ?? C(t)[0]);
|
|
162
176
|
}
|
|
163
|
-
function
|
|
177
|
+
function K(t, e) {
|
|
164
178
|
const n = e.trim().toLowerCase();
|
|
165
179
|
return t instanceof HTMLInputElement && t.type === "radio" ? n === "radio" || n === "radio button" : t instanceof HTMLInputElement && t.type === "checkbox" ? n === "checkbox" || n === "check box" : t instanceof HTMLSelectElement ? n === "select" || n === "select menu" || n === "combobox" || n === "combo box" : !1;
|
|
166
180
|
}
|
|
167
|
-
function
|
|
168
|
-
const e =
|
|
169
|
-
if (n != null && n.trim() && !
|
|
181
|
+
function v(t) {
|
|
182
|
+
const e = H(t), n = t.getAttribute("aria-label");
|
|
183
|
+
if (n != null && n.trim() && !K(t, n))
|
|
170
184
|
return n.trim();
|
|
171
185
|
const o = t.getAttribute("title");
|
|
172
|
-
if (o != null && o.trim() && !
|
|
186
|
+
if (o != null && o.trim() && !K(t, o))
|
|
173
187
|
return o.trim();
|
|
174
188
|
if (e)
|
|
175
189
|
return e;
|
|
176
|
-
const
|
|
177
|
-
return
|
|
190
|
+
const i = C(t)[0];
|
|
191
|
+
return i || b(t);
|
|
178
192
|
}
|
|
179
|
-
function
|
|
180
|
-
if (!(t instanceof HTMLElement || t instanceof SVGElement) || !
|
|
193
|
+
function j(t) {
|
|
194
|
+
if (!(t instanceof HTMLElement || t instanceof SVGElement) || !_(t) || t.matches(
|
|
181
195
|
'input,textarea,select,button,a[href],[role="button"],[role="link"]'
|
|
182
196
|
))
|
|
183
197
|
return !1;
|
|
184
|
-
const e =
|
|
198
|
+
const e = P(t) ?? b(t);
|
|
185
199
|
return !!(e && e.length <= 120);
|
|
186
200
|
}
|
|
187
|
-
function
|
|
188
|
-
var
|
|
189
|
-
if (!
|
|
201
|
+
function Z(t) {
|
|
202
|
+
var l;
|
|
203
|
+
if (!Q(t))
|
|
190
204
|
return;
|
|
191
205
|
const e = t.closest("fieldset"), n = e == null ? void 0 : e.querySelector("legend"), o = n ? b(n) : void 0;
|
|
192
206
|
if (o)
|
|
193
207
|
return o;
|
|
194
|
-
const
|
|
195
|
-
if (!
|
|
208
|
+
const i = t.ownerDocument, s = i.body;
|
|
209
|
+
if (!s)
|
|
196
210
|
return;
|
|
197
|
-
const
|
|
198
|
-
if (
|
|
211
|
+
const r = t.getBoundingClientRect();
|
|
212
|
+
if (r.width <= 0 || r.height <= 0)
|
|
199
213
|
return;
|
|
200
|
-
const
|
|
201
|
-
let
|
|
202
|
-
for (;
|
|
203
|
-
const f =
|
|
204
|
-
if (f !== t && !f.contains(t) && f.matches('legend,strong,b,[role="heading"],h1,h2,h3,h4,h5,h6') &&
|
|
205
|
-
const
|
|
206
|
-
if (
|
|
207
|
-
const
|
|
208
|
-
|
|
209
|
-
text:
|
|
210
|
-
score:
|
|
214
|
+
const a = r.left + r.width / 2, c = [], d = i.createTreeWalker(s, NodeFilter.SHOW_ELEMENT);
|
|
215
|
+
let u = d.nextNode();
|
|
216
|
+
for (; u; ) {
|
|
217
|
+
const f = u;
|
|
218
|
+
if (f !== t && !f.contains(t) && f.matches('legend,strong,b,[role="heading"],h1,h2,h3,h4,h5,h6') && j(f)) {
|
|
219
|
+
const p = f.getBoundingClientRect(), y = P(f) ?? b(f);
|
|
220
|
+
if (y && p.bottom <= r.top + 8) {
|
|
221
|
+
const h = r.top - p.bottom, E = p.left + p.width / 2;
|
|
222
|
+
h <= 160 && E >= r.left - 120 && E <= r.right + 320 && c.push({
|
|
223
|
+
text: y,
|
|
224
|
+
score: h + Math.abs(E - a) * 0.25
|
|
211
225
|
});
|
|
212
226
|
}
|
|
213
227
|
}
|
|
214
|
-
|
|
228
|
+
u = d.nextNode();
|
|
215
229
|
}
|
|
216
|
-
return (
|
|
230
|
+
return (l = c.sort((f, p) => f.score - p.score)[0]) == null ? void 0 : l.text;
|
|
217
231
|
}
|
|
218
|
-
function
|
|
232
|
+
function yt(t) {
|
|
219
233
|
if (!(t instanceof HTMLSelectElement))
|
|
220
234
|
return;
|
|
221
235
|
const e = Array.from(t.options).map((n) => ({
|
|
@@ -226,45 +240,45 @@ function gt(t) {
|
|
|
226
240
|
}));
|
|
227
241
|
return e.length ? e : void 0;
|
|
228
242
|
}
|
|
229
|
-
function
|
|
243
|
+
function Et(t) {
|
|
230
244
|
if (!(t instanceof HTMLSelectElement))
|
|
231
245
|
return;
|
|
232
246
|
const e = t.selectedOptions[0], n = e ? (e.label || e.textContent || e.value).replace(/\s+/g, " ").trim() : void 0;
|
|
233
247
|
return n ? n.slice(0, 160) : void 0;
|
|
234
248
|
}
|
|
235
|
-
function
|
|
249
|
+
function C(t) {
|
|
236
250
|
const e = t.ownerDocument, n = e.body;
|
|
237
251
|
if (!n)
|
|
238
252
|
return [];
|
|
239
253
|
const o = t.getBoundingClientRect();
|
|
240
254
|
if (o.width <= 0 || o.height <= 0)
|
|
241
255
|
return [];
|
|
242
|
-
const
|
|
243
|
-
let
|
|
244
|
-
for (;
|
|
245
|
-
const
|
|
246
|
-
if (
|
|
247
|
-
const
|
|
256
|
+
const i = o.top + o.height / 2, s = o.left + o.width / 2, r = [], a = e.createTreeWalker(n, NodeFilter.SHOW_ELEMENT);
|
|
257
|
+
let c = a.nextNode();
|
|
258
|
+
for (; c; ) {
|
|
259
|
+
const u = c;
|
|
260
|
+
if (u !== t && !u.contains(t) && j(u)) {
|
|
261
|
+
const l = u.getBoundingClientRect(), f = P(u) ?? b(u);
|
|
248
262
|
if (f) {
|
|
249
|
-
const
|
|
250
|
-
if (
|
|
251
|
-
const
|
|
252
|
-
|
|
263
|
+
const p = l.top + l.height / 2, y = l.left + l.width / 2, h = l.right <= o.left + 12 && Math.abs(p - i) <= Math.max(28, o.height * 1.25), E = l.left >= o.right - 8 && l.left - o.right <= 240 && Math.abs(p - i) <= Math.max(28, o.height * 1.25), W = l.bottom <= o.top + 8 && o.top - l.bottom <= 80 && y >= o.left - 80 && y <= o.right + 80;
|
|
264
|
+
if (h || E || W) {
|
|
265
|
+
const ot = h ? o.left - l.right + Math.abs(p - i) : E ? l.left - o.right + Math.abs(p - i) : o.top - l.bottom + Math.abs(y - s);
|
|
266
|
+
r.push({
|
|
253
267
|
text: f,
|
|
254
|
-
score:
|
|
268
|
+
score: ot + (h ? 0 : E ? 5 : 100)
|
|
255
269
|
});
|
|
256
270
|
}
|
|
257
271
|
}
|
|
258
272
|
}
|
|
259
|
-
|
|
273
|
+
c = a.nextNode();
|
|
260
274
|
}
|
|
261
275
|
const d = /* @__PURE__ */ new Set();
|
|
262
|
-
return
|
|
276
|
+
return r.sort((u, l) => u.score - l.score).map((u) => u.text).filter((u) => d.has(u) ? !1 : (d.add(u), !0)).slice(0, 4);
|
|
263
277
|
}
|
|
264
|
-
function
|
|
278
|
+
function mt(t) {
|
|
265
279
|
return t.getAttribute("data-testid") ?? t.getAttribute("data-test-id") ?? t.getAttribute("data-qa") ?? void 0;
|
|
266
280
|
}
|
|
267
|
-
function
|
|
281
|
+
function S(t) {
|
|
268
282
|
const e = t.getAttribute("role");
|
|
269
283
|
if (e != null && e.trim())
|
|
270
284
|
return e.trim();
|
|
@@ -288,65 +302,65 @@ function M(t) {
|
|
|
288
302
|
return "textbox";
|
|
289
303
|
}
|
|
290
304
|
}
|
|
291
|
-
function
|
|
305
|
+
function tt(t) {
|
|
292
306
|
return t instanceof HTMLButtonElement || t instanceof HTMLInputElement || t instanceof HTMLSelectElement || t instanceof HTMLTextAreaElement ? t.disabled || void 0 : t.getAttribute("aria-disabled") === "true" || void 0;
|
|
293
307
|
}
|
|
294
|
-
function
|
|
308
|
+
function wt(t) {
|
|
295
309
|
return t instanceof HTMLInputElement && (t.type === "checkbox" || t.type === "radio") ? t.checked : void 0;
|
|
296
310
|
}
|
|
297
|
-
function
|
|
298
|
-
const e =
|
|
311
|
+
function vt(t) {
|
|
312
|
+
const e = A(t);
|
|
299
313
|
if (!(e.width <= 0 || e.height <= 0))
|
|
300
314
|
return {
|
|
301
315
|
x: e.x + e.width / 2,
|
|
302
316
|
y: e.y + e.height / 2
|
|
303
317
|
};
|
|
304
318
|
}
|
|
305
|
-
function
|
|
319
|
+
function V(t) {
|
|
306
320
|
return {
|
|
307
321
|
tag: t.tagName.toLowerCase(),
|
|
308
|
-
role:
|
|
309
|
-
name:
|
|
310
|
-
selector:
|
|
322
|
+
role: S(t),
|
|
323
|
+
name: v(t),
|
|
324
|
+
selector: q(t)
|
|
311
325
|
};
|
|
312
326
|
}
|
|
313
|
-
function
|
|
327
|
+
function _(t) {
|
|
314
328
|
if (!(t instanceof HTMLElement || t instanceof SVGElement) || t instanceof HTMLElement && t.hidden)
|
|
315
329
|
return !1;
|
|
316
330
|
const e = t.ownerDocument.defaultView, n = e == null ? void 0 : e.getComputedStyle(t);
|
|
317
331
|
return !(n && (n.display === "none" || n.visibility === "hidden" || n.opacity === "0"));
|
|
318
332
|
}
|
|
319
|
-
function
|
|
320
|
-
return t.matches(
|
|
333
|
+
function et(t) {
|
|
334
|
+
return t.matches(st) && _(t);
|
|
321
335
|
}
|
|
322
|
-
function
|
|
323
|
-
return
|
|
336
|
+
function xt(t) {
|
|
337
|
+
return tt(t) !== !0;
|
|
324
338
|
}
|
|
325
|
-
function
|
|
339
|
+
function Tt(t) {
|
|
326
340
|
var n;
|
|
327
|
-
if (
|
|
341
|
+
if (et(t))
|
|
328
342
|
return !0;
|
|
329
343
|
if (!(t instanceof HTMLElement))
|
|
330
344
|
return !1;
|
|
331
345
|
const e = (n = t.ownerDocument.defaultView) == null ? void 0 : n.getComputedStyle(t);
|
|
332
|
-
return ((e == null ? void 0 : e.cursor) === "pointer" || !!t.onclick) &&
|
|
346
|
+
return ((e == null ? void 0 : e.cursor) === "pointer" || !!t.onclick) && _(t);
|
|
333
347
|
}
|
|
334
|
-
function
|
|
335
|
-
var
|
|
348
|
+
function A(t) {
|
|
349
|
+
var s, r;
|
|
336
350
|
const e = t.getBoundingClientRect();
|
|
337
|
-
let n = e.left, o = e.top,
|
|
351
|
+
let n = e.left, o = e.top, i = null;
|
|
338
352
|
try {
|
|
339
|
-
|
|
353
|
+
i = ((s = t.ownerDocument.defaultView) == null ? void 0 : s.frameElement) ?? null;
|
|
340
354
|
} catch {
|
|
341
|
-
|
|
355
|
+
i = null;
|
|
342
356
|
}
|
|
343
|
-
for (;
|
|
344
|
-
const
|
|
345
|
-
n +=
|
|
357
|
+
for (; i; ) {
|
|
358
|
+
const a = i.getBoundingClientRect();
|
|
359
|
+
n += a.left, o += a.top;
|
|
346
360
|
try {
|
|
347
|
-
|
|
361
|
+
i = ((r = i.ownerDocument.defaultView) == null ? void 0 : r.frameElement) ?? null;
|
|
348
362
|
} catch {
|
|
349
|
-
|
|
363
|
+
i = null;
|
|
350
364
|
}
|
|
351
365
|
}
|
|
352
366
|
return {
|
|
@@ -356,21 +370,21 @@ function k(t) {
|
|
|
356
370
|
height: e.height
|
|
357
371
|
};
|
|
358
372
|
}
|
|
359
|
-
function
|
|
373
|
+
function q(t) {
|
|
360
374
|
const e = (o) => typeof CSS < "u" && typeof CSS.escape == "function" ? CSS.escape(o) : o.replaceAll("\\", "\\\\").replaceAll('"', '\\"');
|
|
361
375
|
if (t.id)
|
|
362
376
|
return `#${e(t.id)}`;
|
|
363
377
|
for (const o of ["data-testid", "data-test-id", "data-qa"]) {
|
|
364
|
-
const
|
|
365
|
-
if (
|
|
366
|
-
return `[${o}="${e(
|
|
378
|
+
const i = t.getAttribute(o);
|
|
379
|
+
if (i)
|
|
380
|
+
return `[${o}="${e(i)}"]`;
|
|
367
381
|
}
|
|
368
382
|
const n = t.getAttribute("name");
|
|
369
383
|
return n ? `${t.tagName.toLowerCase()}[name="${e(
|
|
370
384
|
n
|
|
371
385
|
)}"]` : t.tagName.toLowerCase();
|
|
372
386
|
}
|
|
373
|
-
function
|
|
387
|
+
function _t(t) {
|
|
374
388
|
const e = t.getBoundingClientRect();
|
|
375
389
|
if (!(e.width <= 0 || e.height <= 0))
|
|
376
390
|
return {
|
|
@@ -378,7 +392,7 @@ function vt(t) {
|
|
|
378
392
|
y: e.top + e.height / 2
|
|
379
393
|
};
|
|
380
394
|
}
|
|
381
|
-
function
|
|
395
|
+
function nt(t, e) {
|
|
382
396
|
if (typeof t.elementsFromPoint == "function")
|
|
383
397
|
return t.elementsFromPoint(e.x, e.y);
|
|
384
398
|
if (typeof t.elementFromPoint != "function")
|
|
@@ -386,25 +400,25 @@ function Q(t, e) {
|
|
|
386
400
|
const n = t.elementFromPoint(e.x, e.y);
|
|
387
401
|
return n ? [n] : [];
|
|
388
402
|
}
|
|
389
|
-
function
|
|
403
|
+
function St(t) {
|
|
390
404
|
return typeof t.elementsFromPoint == "function" || typeof t.elementFromPoint == "function";
|
|
391
405
|
}
|
|
392
|
-
function
|
|
406
|
+
function R(t, e) {
|
|
393
407
|
return t === e || t.contains(e);
|
|
394
408
|
}
|
|
395
|
-
function
|
|
409
|
+
function kt(t) {
|
|
396
410
|
let e = t;
|
|
397
411
|
for (; e; ) {
|
|
398
|
-
if (
|
|
412
|
+
if (Tt(e))
|
|
399
413
|
return e;
|
|
400
414
|
e = e.parentElement;
|
|
401
415
|
}
|
|
402
416
|
return t;
|
|
403
417
|
}
|
|
404
|
-
function
|
|
418
|
+
function J(t) {
|
|
405
419
|
return (t ?? "").replace(/\([^)]*\)/g, "").replace(/\s+/g, "").trim().toLowerCase();
|
|
406
420
|
}
|
|
407
|
-
function
|
|
421
|
+
function B(t) {
|
|
408
422
|
const e = t.getBoundingClientRect();
|
|
409
423
|
if (e.width <= 0 || e.height <= 0)
|
|
410
424
|
return;
|
|
@@ -416,100 +430,158 @@ function V(t) {
|
|
|
416
430
|
{ x: e.left + e.width / 2, y: e.top + Math.min(8, e.height / 2) },
|
|
417
431
|
{ x: e.left + e.width / 2, y: e.bottom - Math.min(8, e.height / 2) }
|
|
418
432
|
].find(
|
|
419
|
-
(
|
|
420
|
-
(
|
|
433
|
+
(i) => nt(n, i).some(
|
|
434
|
+
(s) => R(t, s) || R(s, t)
|
|
421
435
|
)
|
|
422
436
|
);
|
|
423
437
|
}
|
|
424
438
|
function Mt(t, e) {
|
|
425
|
-
const n = t.getBoundingClientRect(), o =
|
|
439
|
+
const n = t.getBoundingClientRect(), o = A(t);
|
|
426
440
|
return {
|
|
427
441
|
x: e.x + o.x - n.left,
|
|
428
442
|
y: e.y + o.y - n.top
|
|
429
443
|
};
|
|
430
444
|
}
|
|
431
|
-
function
|
|
432
|
-
var
|
|
433
|
-
const n =
|
|
434
|
-
return o ? ((
|
|
435
|
-
const
|
|
436
|
-
return n &&
|
|
437
|
-
}).map((
|
|
438
|
-
candidate:
|
|
439
|
-
point:
|
|
440
|
-
rect:
|
|
445
|
+
function Lt(t, e) {
|
|
446
|
+
var s;
|
|
447
|
+
const n = S(e), o = J(v(e));
|
|
448
|
+
return o ? ((s = $(t).filter((r) => r !== e).filter((r) => {
|
|
449
|
+
const a = S(r), c = J(v(r));
|
|
450
|
+
return n && a && n !== a ? !1 : c.includes(o) || o.includes(c);
|
|
451
|
+
}).map((r) => ({
|
|
452
|
+
candidate: r,
|
|
453
|
+
point: B(r),
|
|
454
|
+
rect: A(r)
|
|
441
455
|
})).filter(
|
|
442
|
-
(
|
|
443
|
-
).sort((
|
|
456
|
+
(r) => !!r.point
|
|
457
|
+
).sort((r, a) => a.rect.y - r.rect.y)[0]) == null ? void 0 : s.candidate) ?? null : null;
|
|
444
458
|
}
|
|
445
|
-
function
|
|
446
|
-
const e = t.ownerDocument, n =
|
|
459
|
+
function g(t) {
|
|
460
|
+
const e = t.ownerDocument, n = _t(t), o = _(t) && !!n, i = xt(t), s = n ? nt(e, n) : [], r = s[0], a = !!(r && (R(t, r) || R(r, t)));
|
|
447
461
|
return {
|
|
448
462
|
visible: o,
|
|
449
|
-
enabled:
|
|
450
|
-
receivesEvents:
|
|
451
|
-
actionable: o &&
|
|
452
|
-
center:
|
|
453
|
-
hitTarget:
|
|
454
|
-
hitStack:
|
|
463
|
+
enabled: i,
|
|
464
|
+
receivesEvents: a,
|
|
465
|
+
actionable: o && i && a,
|
|
466
|
+
center: vt(t),
|
|
467
|
+
hitTarget: r,
|
|
468
|
+
hitStack: s
|
|
455
469
|
};
|
|
456
470
|
}
|
|
457
|
-
function
|
|
458
|
-
var
|
|
459
|
-
const n =
|
|
471
|
+
function Ct(t, e) {
|
|
472
|
+
var a, c, d;
|
|
473
|
+
const n = x(e.testId);
|
|
460
474
|
if (n) {
|
|
461
|
-
const
|
|
462
|
-
`[data-testid="${
|
|
475
|
+
const u = typeof CSS < "u" && typeof CSS.escape == "function" ? CSS.escape(n) : n.replaceAll("\\", "\\\\").replaceAll('"', '\\"'), l = t.querySelector(
|
|
476
|
+
`[data-testid="${u}"],[data-test-id="${u}"],[data-qa="${u}"]`
|
|
463
477
|
);
|
|
464
|
-
if (
|
|
465
|
-
return
|
|
466
|
-
}
|
|
467
|
-
const o = (
|
|
468
|
-
return !o && !
|
|
469
|
-
var
|
|
470
|
-
const
|
|
471
|
-
return !(o &&
|
|
478
|
+
if (l)
|
|
479
|
+
return l;
|
|
480
|
+
}
|
|
481
|
+
const o = (a = x(e.role)) == null ? void 0 : a.toLowerCase(), i = (c = x(e.name)) == null ? void 0 : c.toLowerCase(), s = (d = x(e.text)) == null ? void 0 : d.toLowerCase();
|
|
482
|
+
return !o && !i && !s ? null : $(t).find((u) => {
|
|
483
|
+
var y, h, E;
|
|
484
|
+
const l = (y = S(u)) == null ? void 0 : y.toLowerCase(), f = (h = v(u)) == null ? void 0 : h.toLowerCase(), p = (E = b(u)) == null ? void 0 : E.toLowerCase();
|
|
485
|
+
return !(o && l !== o || i && !(f != null && f.includes(i)) || s && !(p != null && p.includes(s)));
|
|
472
486
|
}) ?? null;
|
|
473
487
|
}
|
|
474
|
-
function
|
|
475
|
-
|
|
488
|
+
function At(t) {
|
|
489
|
+
return [
|
|
490
|
+
v(t),
|
|
491
|
+
H(t),
|
|
492
|
+
Z(t),
|
|
493
|
+
b(t),
|
|
494
|
+
F(t)
|
|
495
|
+
].filter((e) => !!e).join(" ").toLowerCase();
|
|
496
|
+
}
|
|
497
|
+
function Nt(t, e) {
|
|
498
|
+
const n = e.trim().toLowerCase();
|
|
499
|
+
let o = t, i = 0;
|
|
500
|
+
for (; o && i < 5; ) {
|
|
501
|
+
const s = o.tagName.toLowerCase();
|
|
502
|
+
if (s === "body" || s === "html")
|
|
503
|
+
return !1;
|
|
504
|
+
if (At(o).includes(n))
|
|
505
|
+
return !0;
|
|
506
|
+
o = o.parentElement, i += 1;
|
|
507
|
+
}
|
|
508
|
+
return !1;
|
|
509
|
+
}
|
|
510
|
+
function Rt(t) {
|
|
511
|
+
if (!t || typeof t != "object" || Array.isArray(t))
|
|
512
|
+
return;
|
|
513
|
+
const e = t;
|
|
514
|
+
if (e.type === "field_contains" && typeof e.field == "string" && e.field.trim() && typeof e.value == "string")
|
|
515
|
+
return {
|
|
516
|
+
type: "field_contains",
|
|
517
|
+
field: e.field,
|
|
518
|
+
value: e.value
|
|
519
|
+
};
|
|
520
|
+
}
|
|
521
|
+
function Pt(t, e) {
|
|
522
|
+
const n = e.trim().toLowerCase();
|
|
523
|
+
return Array.from(t.querySelectorAll("input,textarea,select")).find(
|
|
524
|
+
(o) => [
|
|
525
|
+
H(o),
|
|
526
|
+
v(o),
|
|
527
|
+
o.getAttribute("name") ?? void 0,
|
|
528
|
+
o.getAttribute("placeholder") ?? void 0,
|
|
529
|
+
...C(o)
|
|
530
|
+
].some(
|
|
531
|
+
(s) => s == null ? void 0 : s.trim().toLowerCase().includes(n)
|
|
532
|
+
)
|
|
533
|
+
);
|
|
534
|
+
}
|
|
535
|
+
function Ht(t, e) {
|
|
536
|
+
if (!e)
|
|
537
|
+
return;
|
|
538
|
+
const n = Pt(t, e.field), o = n ? F(n) ?? "" : void 0;
|
|
539
|
+
return {
|
|
540
|
+
...e,
|
|
541
|
+
ok: typeof o == "string" && o.toLowerCase().includes(e.value.toLowerCase()),
|
|
542
|
+
actual: o,
|
|
543
|
+
matchedField: n ? V(n) : void 0
|
|
544
|
+
};
|
|
545
|
+
}
|
|
546
|
+
function $(t) {
|
|
547
|
+
const e = t instanceof Element ? t.ownerDocument : T(t), n = t instanceof Document ? t.body ?? t.documentElement : t;
|
|
476
548
|
if (!n)
|
|
477
549
|
return [];
|
|
478
|
-
const o = [],
|
|
479
|
-
const
|
|
480
|
-
let
|
|
481
|
-
for (;
|
|
482
|
-
const
|
|
483
|
-
|
|
484
|
-
const d =
|
|
485
|
-
if (d &&
|
|
550
|
+
const o = [], i = (s) => {
|
|
551
|
+
const r = e.createTreeWalker(s, NodeFilter.SHOW_ELEMENT);
|
|
552
|
+
let a = r.nextNode();
|
|
553
|
+
for (; a; ) {
|
|
554
|
+
const c = a;
|
|
555
|
+
et(c) && o.push(c);
|
|
556
|
+
const d = c.shadowRoot;
|
|
557
|
+
if (d && i(d), c instanceof HTMLIFrameElement)
|
|
486
558
|
try {
|
|
487
|
-
|
|
559
|
+
c.contentDocument && i(c.contentDocument);
|
|
488
560
|
} catch {
|
|
489
561
|
}
|
|
490
|
-
if (o.length >=
|
|
562
|
+
if (o.length >= X)
|
|
491
563
|
return;
|
|
492
|
-
|
|
564
|
+
a = r.nextNode();
|
|
493
565
|
}
|
|
494
566
|
};
|
|
495
|
-
return
|
|
567
|
+
return i(n), o.slice(0, X);
|
|
496
568
|
}
|
|
497
|
-
function
|
|
498
|
-
var
|
|
569
|
+
function Ot(t, e) {
|
|
570
|
+
var i;
|
|
499
571
|
const n = Object.getPrototypeOf(t), o = Object.getOwnPropertyDescriptor(n, "value");
|
|
500
|
-
(
|
|
572
|
+
(i = o == null ? void 0 : o.set) == null || i.call(t, e);
|
|
501
573
|
}
|
|
502
574
|
function I(t) {
|
|
503
575
|
t.dispatchEvent(new Event("input", { bubbles: !0 })), t.dispatchEvent(new Event("change", { bubbles: !0 }));
|
|
504
576
|
}
|
|
505
|
-
function
|
|
577
|
+
function M(t) {
|
|
506
578
|
var e, n;
|
|
507
579
|
(t instanceof HTMLElement || t instanceof SVGElement) && ((e = t.scrollIntoView) == null || e.call(t, { block: "center", inline: "center" })), t instanceof HTMLElement && ((n = t.focus) == null || n.call(t));
|
|
508
580
|
}
|
|
509
581
|
function L(t, e) {
|
|
510
582
|
return typeof PointerEvent == "function" ? new PointerEvent(t, e) : new MouseEvent(t.replace("pointer", "mouse"), e);
|
|
511
583
|
}
|
|
512
|
-
class
|
|
584
|
+
class It {
|
|
513
585
|
constructor(e = {}) {
|
|
514
586
|
this.options = e, this.refs = /* @__PURE__ */ new Map(), this.nextRef = 1;
|
|
515
587
|
}
|
|
@@ -544,10 +616,10 @@ class kt {
|
|
|
544
616
|
}
|
|
545
617
|
}
|
|
546
618
|
snapshot() {
|
|
547
|
-
var
|
|
619
|
+
var s, r;
|
|
548
620
|
this.refs.clear(), this.nextRef = 1;
|
|
549
|
-
const e = this.getRoot(), n =
|
|
550
|
-
(
|
|
621
|
+
const e = this.getRoot(), n = T(e), o = N(e), i = $(e).map(
|
|
622
|
+
(a) => this.snapshotElement(a)
|
|
551
623
|
);
|
|
552
624
|
return {
|
|
553
625
|
url: o.location.href,
|
|
@@ -572,28 +644,28 @@ class kt {
|
|
|
572
644
|
readyState: n.readyState,
|
|
573
645
|
visibilityState: n.visibilityState,
|
|
574
646
|
focusedElement: n.activeElement && n.activeElement !== n.body ? this.snapshotElementWithoutRef(n.activeElement) : void 0,
|
|
575
|
-
selection: ((
|
|
647
|
+
selection: ((r = (s = n.getSelection) == null ? void 0 : s.call(n)) == null ? void 0 : r.toString()) || void 0
|
|
576
648
|
},
|
|
577
649
|
navigation: this.getNavigationState(o),
|
|
578
650
|
frames: this.getFrameState(n),
|
|
579
|
-
accessibility:
|
|
580
|
-
ref:
|
|
581
|
-
role:
|
|
582
|
-
name:
|
|
583
|
-
value:
|
|
584
|
-
disabled:
|
|
585
|
-
checked:
|
|
586
|
-
focused: n.activeElement === this.refs.get(
|
|
651
|
+
accessibility: i.map((a) => ({
|
|
652
|
+
ref: a.ref,
|
|
653
|
+
role: a.role,
|
|
654
|
+
name: a.name,
|
|
655
|
+
value: a.value,
|
|
656
|
+
disabled: a.disabled,
|
|
657
|
+
checked: a.checked,
|
|
658
|
+
focused: n.activeElement === this.refs.get(a.ref)
|
|
587
659
|
})),
|
|
588
|
-
elements:
|
|
660
|
+
elements: i
|
|
589
661
|
};
|
|
590
662
|
}
|
|
591
663
|
getRoot() {
|
|
592
664
|
return this.options.root ?? document;
|
|
593
665
|
}
|
|
594
666
|
getNavigationState(e) {
|
|
595
|
-
var o,
|
|
596
|
-
const n = (
|
|
667
|
+
var o, i, s;
|
|
668
|
+
const n = (s = (i = (o = e.performance) == null ? void 0 : o.getEntriesByType) == null ? void 0 : i.call(o, "navigation")) == null ? void 0 : s[0];
|
|
597
669
|
if (!(typeof PerformanceNavigationTiming != "function" || !(n instanceof PerformanceNavigationTiming)))
|
|
598
670
|
return {
|
|
599
671
|
type: n.type,
|
|
@@ -604,12 +676,12 @@ class kt {
|
|
|
604
676
|
}
|
|
605
677
|
getFrameState(e) {
|
|
606
678
|
return Array.from(e.querySelectorAll("iframe")).map((n) => {
|
|
607
|
-
var
|
|
608
|
-
const o =
|
|
679
|
+
var i, s;
|
|
680
|
+
const o = A(n);
|
|
609
681
|
try {
|
|
610
682
|
return {
|
|
611
|
-
url: (
|
|
612
|
-
title: (
|
|
683
|
+
url: (i = n.contentWindow) == null ? void 0 : i.location.href,
|
|
684
|
+
title: (s = n.contentDocument) == null ? void 0 : s.title,
|
|
613
685
|
sameOrigin: !0,
|
|
614
686
|
rect: o
|
|
615
687
|
};
|
|
@@ -630,159 +702,156 @@ class kt {
|
|
|
630
702
|
return this.createElementSnapshot(e, "");
|
|
631
703
|
}
|
|
632
704
|
createElementSnapshot(e, n) {
|
|
633
|
-
const o = (e instanceof HTMLInputElement || e instanceof HTMLTextAreaElement) && e.placeholder || void 0,
|
|
705
|
+
const o = (e instanceof HTMLInputElement || e instanceof HTMLTextAreaElement) && e.placeholder || void 0, i = g(e);
|
|
634
706
|
return {
|
|
635
707
|
ref: n,
|
|
636
708
|
tag: e.tagName.toLowerCase(),
|
|
637
|
-
role:
|
|
638
|
-
name:
|
|
639
|
-
label:
|
|
640
|
-
groupLabel:
|
|
709
|
+
role: S(e),
|
|
710
|
+
name: v(e),
|
|
711
|
+
label: H(e),
|
|
712
|
+
groupLabel: Z(e),
|
|
641
713
|
text: b(e),
|
|
642
|
-
nearbyText:
|
|
643
|
-
testId:
|
|
644
|
-
value:
|
|
645
|
-
selectedLabel:
|
|
646
|
-
options:
|
|
714
|
+
nearbyText: C(e),
|
|
715
|
+
testId: mt(e),
|
|
716
|
+
value: F(e),
|
|
717
|
+
selectedLabel: Et(e),
|
|
718
|
+
options: yt(e),
|
|
647
719
|
placeholder: o,
|
|
648
|
-
selector:
|
|
649
|
-
disabled:
|
|
650
|
-
enabled:
|
|
651
|
-
checked:
|
|
652
|
-
visible:
|
|
653
|
-
actionable:
|
|
654
|
-
rect:
|
|
655
|
-
center:
|
|
656
|
-
hitTarget:
|
|
657
|
-
hitStack:
|
|
720
|
+
selector: q(e),
|
|
721
|
+
disabled: tt(e),
|
|
722
|
+
enabled: i.enabled,
|
|
723
|
+
checked: wt(e),
|
|
724
|
+
visible: i.visible,
|
|
725
|
+
actionable: i.actionable,
|
|
726
|
+
rect: A(e),
|
|
727
|
+
center: i.center,
|
|
728
|
+
hitTarget: i.hitTarget ? V(i.hitTarget) : void 0,
|
|
729
|
+
hitStack: i.hitStack.slice(0, 5).map(V)
|
|
658
730
|
};
|
|
659
731
|
}
|
|
660
732
|
resolveElement(e) {
|
|
661
|
-
const n =
|
|
733
|
+
const n = x(e.ref) ?? x(e.axRef);
|
|
662
734
|
if (n) {
|
|
663
|
-
const
|
|
664
|
-
if (!
|
|
735
|
+
const s = this.refs.get(n);
|
|
736
|
+
if (!s)
|
|
665
737
|
throw new Error(`Unknown element ref: ${n}. Take a new snapshot.`);
|
|
666
|
-
return
|
|
738
|
+
return s;
|
|
667
739
|
}
|
|
668
|
-
const o =
|
|
740
|
+
const o = x(e.selector);
|
|
669
741
|
if (o) {
|
|
670
|
-
const
|
|
671
|
-
if (!
|
|
742
|
+
const s = this.getRoot().querySelector(o);
|
|
743
|
+
if (!s)
|
|
672
744
|
throw new Error(`No element matches selector: ${o}.`);
|
|
673
|
-
return
|
|
745
|
+
return s;
|
|
674
746
|
}
|
|
675
|
-
const
|
|
676
|
-
if (
|
|
677
|
-
return
|
|
747
|
+
const i = Ct(this.getRoot(), e);
|
|
748
|
+
if (i)
|
|
749
|
+
return i;
|
|
678
750
|
if (typeof e.x < "u" || typeof e.y < "u") {
|
|
679
|
-
const
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
}, i = m(this.getRoot()).elementFromPoint(
|
|
683
|
-
c.x,
|
|
684
|
-
c.y
|
|
751
|
+
const s = U(this.getRoot(), e), r = T(this.getRoot()).elementFromPoint(
|
|
752
|
+
s.x,
|
|
753
|
+
s.y
|
|
685
754
|
);
|
|
686
|
-
if (!
|
|
687
|
-
throw new Error(`No element found at (${
|
|
688
|
-
return
|
|
755
|
+
if (!r)
|
|
756
|
+
throw new Error(`No element found at (${s.x}, ${s.y}).`);
|
|
757
|
+
return r;
|
|
689
758
|
}
|
|
690
759
|
throw new Error(
|
|
691
760
|
"Expected one of ref, selector, role/name/text/testId, or x/y."
|
|
692
761
|
);
|
|
693
762
|
}
|
|
694
763
|
async click(e) {
|
|
695
|
-
const n =
|
|
696
|
-
if (!
|
|
764
|
+
const n = m(e), o = this.resolveElement(n), i = g(o), r = (i.actionable ? null : Lt(this.getRoot(), o)) ?? kt(o);
|
|
765
|
+
if (!B(r) && !i.actionable && St(o.ownerDocument))
|
|
697
766
|
throw new Error(
|
|
698
|
-
`Target "${
|
|
767
|
+
`Target "${v(o) ?? o.tagName.toLowerCase()}" is not receiving pointer events. Take a screenshot or use host_page_pointer coordinates.`
|
|
699
768
|
);
|
|
700
|
-
|
|
701
|
-
const
|
|
702
|
-
return
|
|
769
|
+
M(r);
|
|
770
|
+
const c = B(r), d = g(r), u = g(o), l = c ? Mt(r, c) : d.center ?? i.center;
|
|
771
|
+
return l && await this.showVisualEffect({
|
|
703
772
|
type: "click",
|
|
704
|
-
point:
|
|
773
|
+
point: l,
|
|
705
774
|
anchor: "target",
|
|
706
|
-
target:
|
|
775
|
+
target: r,
|
|
707
776
|
requested: o
|
|
708
|
-
}),
|
|
709
|
-
clicked: this.describeElement(
|
|
777
|
+
}), r instanceof HTMLElement ? r.click() : r.dispatchEvent(new MouseEvent("click", { bubbles: !0 })), {
|
|
778
|
+
clicked: this.describeElement(r),
|
|
710
779
|
requested: this.describeElement(o),
|
|
711
|
-
strategy:
|
|
712
|
-
point:
|
|
780
|
+
strategy: r === o ? "dom" : "semantic_visible_fallback",
|
|
781
|
+
point: l,
|
|
713
782
|
actionability: {
|
|
714
|
-
visible:
|
|
715
|
-
enabled:
|
|
716
|
-
receivesEvents:
|
|
783
|
+
visible: u.visible,
|
|
784
|
+
enabled: u.enabled,
|
|
785
|
+
receivesEvents: u.receivesEvents
|
|
717
786
|
}
|
|
718
787
|
};
|
|
719
788
|
}
|
|
720
789
|
async fill(e) {
|
|
721
|
-
const n =
|
|
722
|
-
if (
|
|
790
|
+
const n = m(e), o = O(n.value, "value"), i = this.resolveElement(n);
|
|
791
|
+
if (M(i), i instanceof HTMLInputElement || i instanceof HTMLTextAreaElement)
|
|
723
792
|
return await this.showVisualEffect({
|
|
724
793
|
type: "fill",
|
|
725
|
-
target:
|
|
726
|
-
requested:
|
|
794
|
+
target: i,
|
|
795
|
+
requested: i,
|
|
727
796
|
value: o,
|
|
728
797
|
anchor: "target",
|
|
729
|
-
point:
|
|
730
|
-
}),
|
|
731
|
-
if (
|
|
798
|
+
point: g(i).center
|
|
799
|
+
}), Ot(i, o), I(i), { filled: this.describeElement(i), value: o };
|
|
800
|
+
if (i instanceof HTMLElement && i.isContentEditable)
|
|
732
801
|
return await this.showVisualEffect({
|
|
733
802
|
type: "fill",
|
|
734
|
-
target:
|
|
735
|
-
requested:
|
|
803
|
+
target: i,
|
|
804
|
+
requested: i,
|
|
736
805
|
value: o,
|
|
737
806
|
anchor: "target",
|
|
738
|
-
point:
|
|
739
|
-
}),
|
|
807
|
+
point: g(i).center
|
|
808
|
+
}), i.textContent = o, I(i), { filled: this.describeElement(i), value: o };
|
|
740
809
|
throw new Error("Target element cannot be filled.");
|
|
741
810
|
}
|
|
742
811
|
async press(e) {
|
|
743
|
-
const n =
|
|
744
|
-
if (!
|
|
812
|
+
const n = m(e), o = O(n.key, "key"), i = n.ref || n.selector || n.x !== void 0 && n.y !== void 0 ? this.resolveElement(n) : T(this.getRoot()).activeElement ?? T(this.getRoot()).body;
|
|
813
|
+
if (!i)
|
|
745
814
|
throw new Error("No target element is available for key press.");
|
|
746
|
-
|
|
815
|
+
M(i), await this.showVisualEffect({
|
|
747
816
|
type: "press",
|
|
748
|
-
target:
|
|
749
|
-
requested:
|
|
817
|
+
target: i,
|
|
818
|
+
requested: i,
|
|
750
819
|
key: o,
|
|
751
820
|
anchor: "target",
|
|
752
|
-
point:
|
|
821
|
+
point: g(i).center
|
|
753
822
|
});
|
|
754
|
-
const
|
|
755
|
-
return
|
|
823
|
+
const s = { key: o, bubbles: !0, cancelable: !0 };
|
|
824
|
+
return i.dispatchEvent(new KeyboardEvent("keydown", s)), o.length === 1 && i.dispatchEvent(new KeyboardEvent("keypress", s)), i.dispatchEvent(new KeyboardEvent("keyup", s)), { pressed: o, target: this.describeElement(i) };
|
|
756
825
|
}
|
|
757
826
|
async select(e) {
|
|
758
|
-
const n =
|
|
759
|
-
if (!(
|
|
827
|
+
const n = m(e), o = ft(n.values ?? n.value), i = this.resolveElement(n);
|
|
828
|
+
if (!(i instanceof HTMLSelectElement))
|
|
760
829
|
throw new Error("Target element is not a select.");
|
|
761
|
-
|
|
762
|
-
const
|
|
830
|
+
M(i);
|
|
831
|
+
const s = new Set(o);
|
|
763
832
|
await this.showVisualEffect({
|
|
764
833
|
type: "select",
|
|
765
|
-
target:
|
|
766
|
-
requested:
|
|
834
|
+
target: i,
|
|
835
|
+
requested: i,
|
|
767
836
|
values: o,
|
|
768
837
|
anchor: "target",
|
|
769
|
-
point:
|
|
838
|
+
point: g(i).center
|
|
770
839
|
});
|
|
771
|
-
for (const
|
|
772
|
-
|
|
773
|
-
return I(
|
|
774
|
-
selected: Array.from(
|
|
775
|
-
(
|
|
840
|
+
for (const r of Array.from(i.options))
|
|
841
|
+
r.selected = s.has(r.value);
|
|
842
|
+
return I(i), {
|
|
843
|
+
selected: Array.from(i.selectedOptions).map(
|
|
844
|
+
(r) => r.value
|
|
776
845
|
),
|
|
777
|
-
target: this.describeElement(
|
|
846
|
+
target: this.describeElement(i)
|
|
778
847
|
};
|
|
779
848
|
}
|
|
780
849
|
async scroll(e) {
|
|
781
|
-
var
|
|
782
|
-
const n =
|
|
783
|
-
x:
|
|
784
|
-
y:
|
|
785
|
-
} : null,
|
|
850
|
+
var c, d, u, l;
|
|
851
|
+
const n = m(e), o = n.x !== void 0 || n.y !== void 0 ? {
|
|
852
|
+
x: k(n.x) ?? 0,
|
|
853
|
+
y: k(n.y) ?? 0
|
|
854
|
+
} : null, i = k(n.deltaX) ?? 0, s = k(n.deltaY) ?? 0, r = this.getRoot(), a = N(r);
|
|
786
855
|
if (n.ref || n.selector || n.role || n.name || n.text || n.testId) {
|
|
787
856
|
const f = this.resolveElement(n);
|
|
788
857
|
if (!(f instanceof HTMLElement))
|
|
@@ -791,111 +860,124 @@ class kt {
|
|
|
791
860
|
type: "scroll",
|
|
792
861
|
target: f,
|
|
793
862
|
requested: f,
|
|
794
|
-
deltaX:
|
|
795
|
-
deltaY:
|
|
863
|
+
deltaX: i,
|
|
864
|
+
deltaY: s,
|
|
796
865
|
anchor: "target",
|
|
797
|
-
point:
|
|
798
|
-
}), o ? (
|
|
866
|
+
point: g(f).center
|
|
867
|
+
}), o ? (c = f.scrollTo) == null || c.call(f, o.x, o.y) : (d = f.scrollBy) == null || d.call(f, i, s), {
|
|
799
868
|
scrolled: this.describeElement(f),
|
|
800
869
|
scroll: { x: f.scrollLeft, y: f.scrollTop }
|
|
801
870
|
};
|
|
802
871
|
}
|
|
803
872
|
return await this.showVisualEffect({
|
|
804
873
|
type: "scroll",
|
|
805
|
-
deltaX:
|
|
806
|
-
deltaY:
|
|
874
|
+
deltaX: i,
|
|
875
|
+
deltaY: s,
|
|
807
876
|
point: {
|
|
808
|
-
x:
|
|
809
|
-
y:
|
|
877
|
+
x: a.innerWidth / 2,
|
|
878
|
+
y: a.innerHeight / 2
|
|
810
879
|
}
|
|
811
|
-
}), o ? (
|
|
880
|
+
}), o ? (u = a.scrollTo) == null || u.call(a, o.x, o.y) : (l = a.scrollBy) == null || l.call(a, i, s), { scroll: { x: a.scrollX, y: a.scrollY } };
|
|
812
881
|
}
|
|
813
882
|
navigate(e) {
|
|
814
883
|
if (this.options.allowNavigation === !1)
|
|
815
884
|
throw new Error("Navigation is disabled for host page automation.");
|
|
816
|
-
const n =
|
|
817
|
-
if (
|
|
885
|
+
const n = m(e), o = this.getRoot(), i = N(o), s = O(n.url, "url"), r = new URL(s, i.location.href);
|
|
886
|
+
if (r.protocol !== "http:" && r.protocol !== "https:")
|
|
818
887
|
throw new Error("Navigation only supports HTTP(S) URLs.");
|
|
819
|
-
return this.refs.clear(),
|
|
888
|
+
return this.refs.clear(), i.location.assign(r.toString()), { navigated: r.toString() };
|
|
820
889
|
}
|
|
821
890
|
async hover(e) {
|
|
822
|
-
const n =
|
|
891
|
+
const n = m(e), o = this.resolveElement(n), i = g(o).center;
|
|
823
892
|
return await this.showVisualEffect({
|
|
824
893
|
type: "hover",
|
|
825
894
|
target: o,
|
|
826
895
|
requested: o,
|
|
827
896
|
anchor: "target",
|
|
828
|
-
point:
|
|
897
|
+
point: i
|
|
829
898
|
}), o.dispatchEvent(
|
|
830
899
|
new MouseEvent("mouseover", {
|
|
831
900
|
bubbles: !0,
|
|
832
901
|
cancelable: !0,
|
|
833
|
-
clientX:
|
|
834
|
-
clientY:
|
|
902
|
+
clientX: i == null ? void 0 : i.x,
|
|
903
|
+
clientY: i == null ? void 0 : i.y
|
|
835
904
|
})
|
|
836
905
|
), o.dispatchEvent(
|
|
837
906
|
new MouseEvent("mousemove", {
|
|
838
907
|
bubbles: !0,
|
|
839
908
|
cancelable: !0,
|
|
840
|
-
clientX:
|
|
841
|
-
clientY:
|
|
909
|
+
clientX: i == null ? void 0 : i.x,
|
|
910
|
+
clientY: i == null ? void 0 : i.y
|
|
842
911
|
})
|
|
843
|
-
), { hovered: this.describeElement(o), point:
|
|
912
|
+
), { hovered: this.describeElement(o), point: i };
|
|
844
913
|
}
|
|
845
914
|
async focus(e) {
|
|
846
|
-
const n =
|
|
847
|
-
return
|
|
915
|
+
const n = m(e), o = this.resolveElement(n);
|
|
916
|
+
return M(o), await this.showVisualEffect({
|
|
848
917
|
type: "focus",
|
|
849
918
|
target: o,
|
|
850
919
|
requested: o,
|
|
851
920
|
anchor: "target",
|
|
852
|
-
point:
|
|
921
|
+
point: g(o).center
|
|
853
922
|
}), { focused: this.describeElement(o) };
|
|
854
923
|
}
|
|
855
924
|
async pointer(e) {
|
|
856
|
-
const n =
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
925
|
+
const n = m(e), o = Y(n.action, ["move", "down", "up", "click"]) ?? "click", i = dt(n.button) ?? 0, s = typeof n.x < "u" || typeof n.y < "u", r = x(n.targetText);
|
|
926
|
+
if (o === "click" && s && !r)
|
|
927
|
+
throw new Error(
|
|
928
|
+
"Pointer coordinate clicks require targetText to avoid unintended navigation."
|
|
929
|
+
);
|
|
930
|
+
const a = n.ref || n.selector || n.role || n.name || n.text || n.testId ? this.resolveElement(n) : null, c = a ? g(a).center : U(this.getRoot(), n);
|
|
931
|
+
if (!c)
|
|
861
932
|
throw new Error("Target element has no clickable point.");
|
|
862
|
-
const
|
|
863
|
-
if (!
|
|
864
|
-
throw new Error(`No element found at (${
|
|
865
|
-
const
|
|
933
|
+
const d = a ?? T(this.getRoot()).elementFromPoint(c.x, c.y);
|
|
934
|
+
if (!d)
|
|
935
|
+
throw new Error(`No element found at (${c.x}, ${c.y}).`);
|
|
936
|
+
const u = r ? Nt(d, r) : void 0;
|
|
937
|
+
if (r && !u)
|
|
938
|
+
throw new Error(
|
|
939
|
+
`Pointer target text mismatch: expected hit target to contain "${r}".`
|
|
940
|
+
);
|
|
941
|
+
const l = {
|
|
866
942
|
bubbles: !0,
|
|
867
943
|
cancelable: !0,
|
|
868
|
-
clientX:
|
|
869
|
-
clientY:
|
|
870
|
-
button:
|
|
944
|
+
clientX: c.x,
|
|
945
|
+
clientY: c.y,
|
|
946
|
+
button: i
|
|
871
947
|
};
|
|
872
948
|
return o === "move" ? (await this.showVisualEffect({
|
|
873
949
|
type: "pointer",
|
|
874
950
|
action: o,
|
|
875
951
|
anchor: "point",
|
|
876
|
-
point:
|
|
877
|
-
target:
|
|
878
|
-
}),
|
|
952
|
+
point: c,
|
|
953
|
+
target: d
|
|
954
|
+
}), d.dispatchEvent(L("pointermove", l)), d.dispatchEvent(new MouseEvent("mousemove", l))) : o === "down" ? (await this.showVisualEffect({
|
|
879
955
|
type: "pointer",
|
|
880
956
|
action: o,
|
|
881
957
|
anchor: "point",
|
|
882
|
-
point:
|
|
883
|
-
target:
|
|
884
|
-
}),
|
|
958
|
+
point: c,
|
|
959
|
+
target: d
|
|
960
|
+
}), d.dispatchEvent(L("pointerdown", l)), d.dispatchEvent(new MouseEvent("mousedown", l))) : o === "up" ? (await this.showVisualEffect({
|
|
885
961
|
type: "pointer",
|
|
886
962
|
action: o,
|
|
887
963
|
anchor: "point",
|
|
888
|
-
point:
|
|
889
|
-
target:
|
|
890
|
-
}),
|
|
964
|
+
point: c,
|
|
965
|
+
target: d
|
|
966
|
+
}), d.dispatchEvent(L("pointerup", l)), d.dispatchEvent(new MouseEvent("mouseup", l))) : (await this.showVisualEffect({
|
|
891
967
|
type: "click",
|
|
892
968
|
anchor: "point",
|
|
893
|
-
point:
|
|
894
|
-
target:
|
|
895
|
-
}),
|
|
969
|
+
point: c,
|
|
970
|
+
target: d
|
|
971
|
+
}), d.dispatchEvent(L("pointerdown", l)), d.dispatchEvent(new MouseEvent("mousedown", l)), d.dispatchEvent(L("pointerup", l)), d.dispatchEvent(new MouseEvent("mouseup", l)), d instanceof HTMLElement ? d.click() : d.dispatchEvent(new MouseEvent("click", l))), {
|
|
896
972
|
pointer: o,
|
|
897
|
-
point:
|
|
898
|
-
|
|
973
|
+
point: c,
|
|
974
|
+
coordinateSpace: "viewport-css-px",
|
|
975
|
+
target: this.describeElement(d),
|
|
976
|
+
targetTextMatched: u,
|
|
977
|
+
expectedAfterClick: o === "click" ? Ht(
|
|
978
|
+
this.getRoot(),
|
|
979
|
+
Rt(n.expectedAfterClick)
|
|
980
|
+
) : void 0
|
|
899
981
|
};
|
|
900
982
|
}
|
|
901
983
|
screenshot() {
|
|
@@ -904,14 +986,14 @@ class kt {
|
|
|
904
986
|
);
|
|
905
987
|
}
|
|
906
988
|
async showVisualEffect(e) {
|
|
907
|
-
var n, o,
|
|
989
|
+
var n, o, i, s;
|
|
908
990
|
try {
|
|
909
991
|
await ((o = (n = this.options).showVisualEffect) == null ? void 0 : o.call(n, e));
|
|
910
992
|
} catch {
|
|
911
993
|
}
|
|
912
994
|
if (!(e.type !== "click" || !e.point || !e.target || this.options.showVisualEffect))
|
|
913
995
|
try {
|
|
914
|
-
await ((
|
|
996
|
+
await ((s = (i = this.options).showClickEffect) == null ? void 0 : s.call(i, {
|
|
915
997
|
point: e.point,
|
|
916
998
|
target: e.target,
|
|
917
999
|
requested: e.requested
|
|
@@ -920,31 +1002,31 @@ class kt {
|
|
|
920
1002
|
}
|
|
921
1003
|
}
|
|
922
1004
|
async waitFor(e) {
|
|
923
|
-
const n =
|
|
1005
|
+
const n = m(e), o = Y(n.state, [
|
|
924
1006
|
"attached",
|
|
925
1007
|
"visible",
|
|
926
1008
|
"hidden",
|
|
927
1009
|
"detached"
|
|
928
|
-
]) ?? "visible",
|
|
929
|
-
|
|
930
|
-
Math.max(0, (
|
|
931
|
-
),
|
|
1010
|
+
]) ?? "visible", i = k(n.timeoutSeconds), s = Math.min(
|
|
1011
|
+
ct,
|
|
1012
|
+
Math.max(0, (i ?? at / 1e3) * 1e3)
|
|
1013
|
+
), r = Date.now(), a = this.tryResolveElement(n);
|
|
932
1014
|
for (await this.showVisualEffect({
|
|
933
1015
|
type: "wait_for",
|
|
934
1016
|
state: o,
|
|
935
|
-
target:
|
|
936
|
-
requested:
|
|
937
|
-
...
|
|
938
|
-
point:
|
|
939
|
-
}); Date.now() -
|
|
940
|
-
const
|
|
941
|
-
if (o === "attached" ? !!
|
|
1017
|
+
target: a ?? void 0,
|
|
1018
|
+
requested: a ?? void 0,
|
|
1019
|
+
...a ? { anchor: "target" } : {},
|
|
1020
|
+
point: a ? g(a).center : void 0
|
|
1021
|
+
}); Date.now() - r <= s; ) {
|
|
1022
|
+
const c = this.tryResolveElement(n);
|
|
1023
|
+
if (o === "attached" ? !!c : o === "detached" ? !c : o === "hidden" ? !c || !_(c) : !!(c && _(c)))
|
|
942
1024
|
return {
|
|
943
1025
|
waitedFor: o,
|
|
944
|
-
elapsedMs: Date.now() -
|
|
945
|
-
target:
|
|
1026
|
+
elapsedMs: Date.now() - r,
|
|
1027
|
+
target: c ? this.describeElement(c) : void 0
|
|
946
1028
|
};
|
|
947
|
-
await new Promise((
|
|
1029
|
+
await new Promise((u) => setTimeout(u, 100));
|
|
948
1030
|
}
|
|
949
1031
|
throw new Error(`Timed out waiting for target to become ${o}.`);
|
|
950
1032
|
}
|
|
@@ -958,54 +1040,268 @@ class kt {
|
|
|
958
1040
|
describeElement(e) {
|
|
959
1041
|
return {
|
|
960
1042
|
tag: e.tagName.toLowerCase(),
|
|
961
|
-
role:
|
|
962
|
-
name:
|
|
963
|
-
selector:
|
|
1043
|
+
role: S(e),
|
|
1044
|
+
name: v(e),
|
|
1045
|
+
selector: q(e)
|
|
964
1046
|
};
|
|
965
1047
|
}
|
|
966
1048
|
}
|
|
967
|
-
function
|
|
1049
|
+
function Dt(t) {
|
|
968
1050
|
return typeof t == "object" && t !== null && !Array.isArray(t) ? t : {};
|
|
969
1051
|
}
|
|
970
|
-
function
|
|
1052
|
+
function Vt(t) {
|
|
971
1053
|
return JSON.stringify(t);
|
|
972
1054
|
}
|
|
973
|
-
function
|
|
1055
|
+
function D(t, e, n) {
|
|
974
1056
|
return {
|
|
975
1057
|
tool_call_id: t.tool_call_id ?? t.id,
|
|
976
1058
|
name: t.name,
|
|
977
1059
|
status: e,
|
|
978
|
-
content:
|
|
1060
|
+
content: Vt(n)
|
|
979
1061
|
};
|
|
980
1062
|
}
|
|
981
|
-
function
|
|
1063
|
+
function qt(t) {
|
|
982
1064
|
return t instanceof Error ? t.message : String(t);
|
|
983
1065
|
}
|
|
984
|
-
function
|
|
985
|
-
const e = new
|
|
1066
|
+
function jt(t = {}) {
|
|
1067
|
+
const e = new It(t);
|
|
986
1068
|
return async (n) => {
|
|
987
|
-
if (!
|
|
988
|
-
return
|
|
1069
|
+
if (!lt(n.name))
|
|
1070
|
+
return D(n, "error", {
|
|
989
1071
|
ok: !1,
|
|
990
1072
|
error: `Unknown host page automation tool: ${n.name}`
|
|
991
1073
|
});
|
|
992
1074
|
try {
|
|
993
1075
|
const o = await e.execute(
|
|
994
1076
|
n.name,
|
|
995
|
-
|
|
1077
|
+
Dt(n.params)
|
|
996
1078
|
);
|
|
997
|
-
return
|
|
1079
|
+
return D(n, "success", { ok: !0, result: o });
|
|
998
1080
|
} catch (o) {
|
|
999
|
-
return
|
|
1081
|
+
return D(n, "error", {
|
|
1000
1082
|
ok: !1,
|
|
1001
|
-
error:
|
|
1083
|
+
error: qt(o)
|
|
1002
1084
|
});
|
|
1003
1085
|
}
|
|
1004
1086
|
};
|
|
1005
1087
|
}
|
|
1088
|
+
const w = {
|
|
1089
|
+
ref: {
|
|
1090
|
+
type: ["string", "number"],
|
|
1091
|
+
description: "Element ref from host_page_snapshot."
|
|
1092
|
+
},
|
|
1093
|
+
axRef: {
|
|
1094
|
+
type: ["string", "number"],
|
|
1095
|
+
description: "Accessibility ref from host_page_snapshot."
|
|
1096
|
+
},
|
|
1097
|
+
selector: {
|
|
1098
|
+
type: "string",
|
|
1099
|
+
description: "CSS selector for the target element."
|
|
1100
|
+
},
|
|
1101
|
+
testId: {
|
|
1102
|
+
type: "string",
|
|
1103
|
+
description: "data-testid, data-test-id, or data-qa value."
|
|
1104
|
+
},
|
|
1105
|
+
role: {
|
|
1106
|
+
type: "string",
|
|
1107
|
+
description: "Accessible role to match."
|
|
1108
|
+
},
|
|
1109
|
+
name: {
|
|
1110
|
+
type: "string",
|
|
1111
|
+
description: "Accessible name to match."
|
|
1112
|
+
},
|
|
1113
|
+
text: {
|
|
1114
|
+
type: "string",
|
|
1115
|
+
description: "Visible text to match."
|
|
1116
|
+
},
|
|
1117
|
+
x: {
|
|
1118
|
+
type: "number",
|
|
1119
|
+
description: "Viewport x coordinate."
|
|
1120
|
+
},
|
|
1121
|
+
y: {
|
|
1122
|
+
type: "number",
|
|
1123
|
+
description: "Viewport y coordinate."
|
|
1124
|
+
}
|
|
1125
|
+
}, Bt = {
|
|
1126
|
+
coordinateSpace: {
|
|
1127
|
+
type: "string",
|
|
1128
|
+
enum: ["viewport-css-px", "viewport_normalized"],
|
|
1129
|
+
description: "Coordinate space for x/y. Use viewport_normalized for screenshot-derived points."
|
|
1130
|
+
}
|
|
1131
|
+
}, Ft = {
|
|
1132
|
+
type: "object",
|
|
1133
|
+
properties: {
|
|
1134
|
+
type: {
|
|
1135
|
+
const: "field_contains",
|
|
1136
|
+
description: "Currently supported post-click expectation type."
|
|
1137
|
+
},
|
|
1138
|
+
field: {
|
|
1139
|
+
type: "string",
|
|
1140
|
+
description: "Field label/name expected to change after clicking."
|
|
1141
|
+
},
|
|
1142
|
+
value: {
|
|
1143
|
+
type: "string",
|
|
1144
|
+
description: "Expected substring in the field value after clicking."
|
|
1145
|
+
}
|
|
1146
|
+
},
|
|
1147
|
+
required: ["type", "field", "value"],
|
|
1148
|
+
additionalProperties: !1
|
|
1149
|
+
}, $t = {
|
|
1150
|
+
host_page_snapshot: {
|
|
1151
|
+
type: "object",
|
|
1152
|
+
properties: {},
|
|
1153
|
+
additionalProperties: !1
|
|
1154
|
+
},
|
|
1155
|
+
host_page_click: {
|
|
1156
|
+
type: "object",
|
|
1157
|
+
properties: {
|
|
1158
|
+
...w
|
|
1159
|
+
},
|
|
1160
|
+
additionalProperties: !1
|
|
1161
|
+
},
|
|
1162
|
+
host_page_fill: {
|
|
1163
|
+
type: "object",
|
|
1164
|
+
properties: {
|
|
1165
|
+
...w,
|
|
1166
|
+
value: {
|
|
1167
|
+
type: "string",
|
|
1168
|
+
description: "Text value to set on the target field."
|
|
1169
|
+
}
|
|
1170
|
+
},
|
|
1171
|
+
required: ["value"],
|
|
1172
|
+
additionalProperties: !1
|
|
1173
|
+
},
|
|
1174
|
+
host_page_press: {
|
|
1175
|
+
type: "object",
|
|
1176
|
+
properties: {
|
|
1177
|
+
...w,
|
|
1178
|
+
key: {
|
|
1179
|
+
type: "string",
|
|
1180
|
+
description: "Keyboard key to press."
|
|
1181
|
+
}
|
|
1182
|
+
},
|
|
1183
|
+
required: ["key"],
|
|
1184
|
+
additionalProperties: !1
|
|
1185
|
+
},
|
|
1186
|
+
host_page_select: {
|
|
1187
|
+
type: "object",
|
|
1188
|
+
properties: {
|
|
1189
|
+
...w,
|
|
1190
|
+
value: {
|
|
1191
|
+
type: ["string", "array"],
|
|
1192
|
+
description: "Select option value or values.",
|
|
1193
|
+
items: { type: "string" }
|
|
1194
|
+
},
|
|
1195
|
+
values: {
|
|
1196
|
+
type: ["string", "array"],
|
|
1197
|
+
description: "Select option values.",
|
|
1198
|
+
items: { type: "string" }
|
|
1199
|
+
}
|
|
1200
|
+
},
|
|
1201
|
+
additionalProperties: !1
|
|
1202
|
+
},
|
|
1203
|
+
host_page_scroll: {
|
|
1204
|
+
type: "object",
|
|
1205
|
+
properties: {
|
|
1206
|
+
...w,
|
|
1207
|
+
deltaX: {
|
|
1208
|
+
type: "number",
|
|
1209
|
+
description: "Horizontal scroll delta."
|
|
1210
|
+
},
|
|
1211
|
+
deltaY: {
|
|
1212
|
+
type: "number",
|
|
1213
|
+
description: "Vertical scroll delta."
|
|
1214
|
+
}
|
|
1215
|
+
},
|
|
1216
|
+
additionalProperties: !1
|
|
1217
|
+
},
|
|
1218
|
+
host_page_navigate: {
|
|
1219
|
+
type: "object",
|
|
1220
|
+
properties: {
|
|
1221
|
+
url: {
|
|
1222
|
+
type: "string",
|
|
1223
|
+
description: "HTTP(S) URL to navigate to."
|
|
1224
|
+
}
|
|
1225
|
+
},
|
|
1226
|
+
required: ["url"],
|
|
1227
|
+
additionalProperties: !1
|
|
1228
|
+
},
|
|
1229
|
+
host_page_hover: {
|
|
1230
|
+
type: "object",
|
|
1231
|
+
properties: {
|
|
1232
|
+
...w
|
|
1233
|
+
},
|
|
1234
|
+
additionalProperties: !1
|
|
1235
|
+
},
|
|
1236
|
+
host_page_focus: {
|
|
1237
|
+
type: "object",
|
|
1238
|
+
properties: {
|
|
1239
|
+
...w
|
|
1240
|
+
},
|
|
1241
|
+
additionalProperties: !1
|
|
1242
|
+
},
|
|
1243
|
+
host_page_pointer: {
|
|
1244
|
+
type: "object",
|
|
1245
|
+
properties: {
|
|
1246
|
+
...w,
|
|
1247
|
+
...Bt,
|
|
1248
|
+
action: {
|
|
1249
|
+
type: "string",
|
|
1250
|
+
enum: ["move", "down", "up", "click"],
|
|
1251
|
+
description: "Pointer action. Defaults to click."
|
|
1252
|
+
},
|
|
1253
|
+
button: {
|
|
1254
|
+
type: ["string", "number"],
|
|
1255
|
+
description: "Mouse button."
|
|
1256
|
+
},
|
|
1257
|
+
clickCount: {
|
|
1258
|
+
type: "number",
|
|
1259
|
+
description: "Number of clicks for CDP mouse click."
|
|
1260
|
+
},
|
|
1261
|
+
targetText: {
|
|
1262
|
+
type: "string",
|
|
1263
|
+
description: "Required for explicit coordinate clicks. The actual hit target or near ancestor must contain this text."
|
|
1264
|
+
},
|
|
1265
|
+
expectedAfterClick: Ft
|
|
1266
|
+
},
|
|
1267
|
+
additionalProperties: !1
|
|
1268
|
+
},
|
|
1269
|
+
host_page_screenshot: {
|
|
1270
|
+
type: "object",
|
|
1271
|
+
properties: {
|
|
1272
|
+
format: {
|
|
1273
|
+
type: "string",
|
|
1274
|
+
enum: ["jpeg", "png"],
|
|
1275
|
+
description: "Screenshot image format."
|
|
1276
|
+
},
|
|
1277
|
+
quality: {
|
|
1278
|
+
type: "number",
|
|
1279
|
+
description: "JPEG quality from 1 to 100."
|
|
1280
|
+
}
|
|
1281
|
+
},
|
|
1282
|
+
additionalProperties: !1
|
|
1283
|
+
},
|
|
1284
|
+
host_page_wait_for: {
|
|
1285
|
+
type: "object",
|
|
1286
|
+
properties: {
|
|
1287
|
+
...w,
|
|
1288
|
+
state: {
|
|
1289
|
+
type: "string",
|
|
1290
|
+
enum: ["attached", "visible", "hidden", "detached"],
|
|
1291
|
+
description: "Target state to wait for. Defaults to visible."
|
|
1292
|
+
},
|
|
1293
|
+
timeoutSeconds: {
|
|
1294
|
+
type: "number",
|
|
1295
|
+
description: "Maximum wait time in seconds."
|
|
1296
|
+
}
|
|
1297
|
+
},
|
|
1298
|
+
additionalProperties: !1
|
|
1299
|
+
}
|
|
1300
|
+
};
|
|
1006
1301
|
export {
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1302
|
+
it as HOST_PAGE_AUTOMATION_TOOL_NAMES,
|
|
1303
|
+
$t as HOST_PAGE_AUTOMATION_TOOL_SCHEMAS,
|
|
1304
|
+
It as HostPageAutomationExecutor,
|
|
1305
|
+
jt as createHostPageAutomationClientToolHandler,
|
|
1306
|
+
lt as isHostPageAutomationToolName
|
|
1011
1307
|
};
|