@nuanu-ai/agentbrowse 0.2.21 → 0.2.22
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/README.md +42 -9
- package/dist/commands/act.d.ts.map +1 -1
- package/dist/commands/act.js +100 -73
- package/dist/commands/action-acceptance.d.ts +4 -1
- package/dist/commands/action-acceptance.d.ts.map +1 -1
- package/dist/commands/action-acceptance.js +127 -37
- package/dist/commands/action-executor-helpers.d.ts.map +1 -1
- package/dist/commands/action-executor-helpers.js +12 -4
- package/dist/commands/action-fallbacks.d.ts.map +1 -1
- package/dist/commands/action-result-resolution.d.ts.map +1 -1
- package/dist/commands/action-result-resolution.js +1 -1
- package/dist/commands/action-value-projection.d.ts.map +1 -1
- package/dist/commands/datepicker-action-executor.d.ts.map +1 -1
- package/dist/commands/datepicker-action-executor.js +1 -1
- package/dist/commands/descriptor-validation.d.ts.map +1 -1
- package/dist/commands/descriptor-validation.js +13 -172
- package/dist/commands/extract-scoped-dialog-text.d.ts.map +1 -1
- package/dist/commands/extract-scoped-dialog-text.js +1 -4
- package/dist/commands/extract-snapshot-sanitizer.d.ts.map +1 -1
- package/dist/commands/extract-stagehand-executor.d.ts.map +1 -1
- package/dist/commands/extract.d.ts.map +1 -1
- package/dist/commands/extract.js +23 -4
- package/dist/commands/observe-accessibility.d.ts +22 -0
- package/dist/commands/observe-accessibility.d.ts.map +1 -0
- package/dist/commands/observe-accessibility.js +497 -0
- package/dist/commands/observe-display-label.d.ts +4 -0
- package/dist/commands/observe-display-label.d.ts.map +1 -0
- package/dist/commands/observe-display-label.js +26 -0
- package/dist/commands/observe-dom-label-contract.d.ts +2 -0
- package/dist/commands/observe-dom-label-contract.d.ts.map +1 -0
- package/dist/commands/observe-dom-label-contract.js +521 -0
- package/dist/commands/observe-fallback-semantics.d.ts +6 -0
- package/dist/commands/observe-fallback-semantics.d.ts.map +1 -0
- package/dist/commands/observe-fallback-semantics.js +86 -0
- package/dist/commands/observe-inventory.d.ts +23 -18
- package/dist/commands/observe-inventory.d.ts.map +1 -1
- package/dist/commands/observe-inventory.js +172 -719
- package/dist/commands/observe-label-policy.d.ts +8 -0
- package/dist/commands/observe-label-policy.d.ts.map +1 -0
- package/dist/commands/observe-label-policy.js +21 -0
- package/dist/commands/observe-page-state.d.ts +1 -1
- package/dist/commands/observe-page-state.d.ts.map +1 -1
- package/dist/commands/observe-persistence.d.ts.map +1 -1
- package/dist/commands/observe-persistence.js +10 -3
- package/dist/commands/observe-projection.d.ts +2 -1
- package/dist/commands/observe-projection.d.ts.map +1 -1
- package/dist/commands/observe-projection.js +5 -2
- package/dist/commands/observe-semantics.d.ts.map +1 -1
- package/dist/commands/observe-semantics.js +18 -1
- package/dist/commands/observe-signals.d.ts +48 -0
- package/dist/commands/observe-signals.d.ts.map +1 -0
- package/dist/commands/observe-signals.js +461 -0
- package/dist/commands/observe-stagehand.d.ts.map +1 -1
- package/dist/commands/observe-stagehand.js +5 -18
- package/dist/commands/observe-surfaces.d.ts.map +1 -1
- package/dist/commands/observe-surfaces.js +5 -4
- package/dist/commands/observe.d.ts +0 -6
- package/dist/commands/observe.d.ts.map +1 -1
- package/dist/commands/observe.js +30 -6
- package/dist/commands/observe.test-harness.d.ts +0 -6
- package/dist/commands/observe.test-harness.d.ts.map +1 -1
- package/dist/commands/screenshot.d.ts.map +1 -1
- package/dist/commands/select-action-executor.d.ts.map +1 -1
- package/dist/commands/select-action-executor.js +1 -1
- package/dist/commands/semantic-observe.d.ts.map +1 -1
- package/dist/commands/semantic-observe.js +1 -4
- package/dist/commands/status.d.ts.map +1 -1
- package/dist/commands/text-input-action-executor.d.ts.map +1 -1
- package/dist/commands/text-input-action-executor.js +1 -1
- package/dist/control-semantics.d.ts.map +1 -1
- package/dist/control-semantics.js +2 -6
- package/dist/playwright-runtime.d.ts.map +1 -1
- package/dist/playwright-runtime.js +3 -4
- package/dist/runtime-state.d.ts +3 -0
- package/dist/runtime-state.d.ts.map +1 -1
- package/dist/runtime-state.js +3 -0
- package/dist/secrets/catalog-applicability.d.ts.map +1 -1
- package/dist/secrets/form-matcher.d.ts.map +1 -1
- package/dist/secrets/form-matcher.js +2 -1
- package/dist/secrets/mock-agentpay-backend.d.ts +1 -1
- package/dist/secrets/mock-agentpay-backend.d.ts.map +1 -1
- package/dist/secrets/mock-agentpay-backend.js +2 -4
- package/dist/secrets/mock-agentpay-cabinet.d.ts.map +1 -1
- package/dist/secrets/mock-agentpay-cabinet.js +6 -1
- package/dist/secrets/protected-field-values.d.ts.map +1 -1
- package/dist/secrets/protected-field-values.js +1 -1
- package/dist/secrets/protected-fill.d.ts.map +1 -1
- package/dist/secrets/protected-fill.js +16 -4
- package/dist/solver/captcha-detector.d.ts.map +1 -1
- package/package.json +3 -3
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { OBSERVE_DOM_LABEL_CONTRACT_HELPER_SCRIPT } from './observe-dom-label-contract.js';
|
|
1
2
|
export function normalizePageSignature(url) {
|
|
2
3
|
try {
|
|
3
4
|
const parsed = new URL(url);
|
|
@@ -8,184 +9,30 @@ export function normalizePageSignature(url) {
|
|
|
8
9
|
}
|
|
9
10
|
}
|
|
10
11
|
export const LOCATOR_DOM_SIGNATURE_SCRIPT = String.raw `
|
|
12
|
+
${OBSERVE_DOM_LABEL_CONTRACT_HELPER_SCRIPT}
|
|
11
13
|
if (!(element instanceof HTMLElement)) {
|
|
12
14
|
return null;
|
|
13
15
|
}
|
|
14
16
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
['button', 'submit', 'reset'].includes(inputTypeOf());
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
const inferRole = () => {
|
|
26
|
-
const explicitRole = element.getAttribute('role')?.trim();
|
|
27
|
-
if (explicitRole) return explicitRole;
|
|
28
|
-
|
|
29
|
-
const tag = element.tagName.toLowerCase();
|
|
30
|
-
if (tag === 'button') return 'button';
|
|
31
|
-
if (tag === 'a' && element.getAttribute('href')) return 'link';
|
|
32
|
-
if (tag === 'select') return 'combobox';
|
|
33
|
-
if (tag === 'textarea') return 'textbox';
|
|
34
|
-
if (tag === 'input') {
|
|
35
|
-
if (isButtonLikeInput()) return 'button';
|
|
36
|
-
return 'textbox';
|
|
37
|
-
}
|
|
38
|
-
return '';
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
const textOf = (target) => {
|
|
42
|
-
if (target === element && isButtonLikeInput()) {
|
|
43
|
-
const value = (element.getAttribute('value') || element.value || '').trim();
|
|
44
|
-
if (value) {
|
|
45
|
-
return value.replace(/\s+/g, ' ');
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
const value = target?.innerText?.trim() || target?.textContent?.trim() || '';
|
|
49
|
-
return value.replace(/\s+/g, ' ');
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
const isMeaningfulLabel = (value) => {
|
|
53
|
-
const normalized = (value || '').replace(/\s+/g, ' ').trim();
|
|
54
|
-
return Boolean(normalized) && normalized !== '[object Object]';
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
const composedParentElement = (node) => {
|
|
58
|
-
if (!node) {
|
|
59
|
-
return null;
|
|
60
|
-
}
|
|
61
|
-
if (node.parentElement) {
|
|
62
|
-
return node.parentElement;
|
|
63
|
-
}
|
|
64
|
-
const root = node.getRootNode?.();
|
|
65
|
-
return root instanceof ShadowRoot && root.host instanceof HTMLElement ? root.host : null;
|
|
66
|
-
};
|
|
67
|
-
|
|
68
|
-
const ariaLabelledbyTextOf = () => {
|
|
69
|
-
const labelledBy = element.getAttribute('aria-labelledby')?.trim();
|
|
70
|
-
if (!labelledBy) return undefined;
|
|
71
|
-
|
|
72
|
-
const text = labelledBy
|
|
73
|
-
.split(/\s+/)
|
|
74
|
-
.map((id) => textOf(document.getElementById(id)))
|
|
75
|
-
.filter(Boolean)
|
|
76
|
-
.join(' ')
|
|
77
|
-
.trim();
|
|
78
|
-
|
|
79
|
-
return isMeaningfulLabel(text) ? text : undefined;
|
|
80
|
-
};
|
|
81
|
-
|
|
82
|
-
const nearestFieldLabelOf = () => {
|
|
83
|
-
const anchors = [
|
|
84
|
-
composedParentElement(element),
|
|
85
|
-
composedParentElement(composedParentElement(element)),
|
|
86
|
-
composedParentElement(composedParentElement(composedParentElement(element))),
|
|
87
|
-
].filter(Boolean);
|
|
88
|
-
|
|
89
|
-
for (const anchor of anchors) {
|
|
90
|
-
if (!(anchor instanceof HTMLElement)) continue;
|
|
91
|
-
|
|
92
|
-
const explicitLabels = Array.from(
|
|
93
|
-
anchor.querySelectorAll('label, legend, [class*="label"], [data-testid*="label"]')
|
|
94
|
-
).filter((candidate) => {
|
|
95
|
-
return (
|
|
96
|
-
candidate instanceof HTMLElement &&
|
|
97
|
-
candidate !== element &&
|
|
98
|
-
!candidate.contains(element) &&
|
|
99
|
-
!element.contains(candidate)
|
|
100
|
-
);
|
|
101
|
-
});
|
|
102
|
-
|
|
103
|
-
for (const candidate of explicitLabels) {
|
|
104
|
-
const candidateText = textOf(candidate);
|
|
105
|
-
if (isMeaningfulLabel(candidateText)) {
|
|
106
|
-
return candidateText;
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
for (const child of Array.from(anchor.children).slice(0, 8)) {
|
|
111
|
-
if (!(child instanceof HTMLElement)) continue;
|
|
112
|
-
if (child === element || child.contains(element) || element.contains(child)) continue;
|
|
113
|
-
|
|
114
|
-
const candidateText = textOf(child);
|
|
115
|
-
if (isMeaningfulLabel(candidateText)) {
|
|
116
|
-
return candidateText;
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
return undefined;
|
|
122
|
-
};
|
|
123
|
-
|
|
124
|
-
const syntheticLabelOf = () => {
|
|
125
|
-
const tag = element.tagName.toLowerCase();
|
|
126
|
-
const explicitRole = element.getAttribute('role')?.trim();
|
|
127
|
-
if (tag === 'input') {
|
|
128
|
-
const inputType = inputTypeOf();
|
|
129
|
-
if (isButtonLikeInput()) return 'Button';
|
|
130
|
-
if (inputType === 'tel') return 'Phone input';
|
|
131
|
-
if (inputType === 'email') return 'Email input';
|
|
132
|
-
if (inputType === 'password') return 'Password input';
|
|
133
|
-
if (inputType === 'search') return 'Search input';
|
|
134
|
-
if (inputType === 'date') return 'Date input';
|
|
135
|
-
return 'Text input';
|
|
136
|
-
}
|
|
137
|
-
if (tag === 'textarea') return 'Text area';
|
|
138
|
-
if (tag === 'select' || explicitRole === 'combobox') return 'Combobox';
|
|
139
|
-
if (explicitRole === 'textbox') return 'Text input';
|
|
140
|
-
return undefined;
|
|
141
|
-
};
|
|
142
|
-
|
|
143
|
-
const labelOf = () => {
|
|
144
|
-
const ariaLabel = element.getAttribute('aria-label')?.trim();
|
|
145
|
-
if (isMeaningfulLabel(ariaLabel)) return ariaLabel;
|
|
146
|
-
|
|
147
|
-
const customLabel = element.getAttribute('label')?.trim();
|
|
148
|
-
if (isMeaningfulLabel(customLabel)) return customLabel;
|
|
149
|
-
|
|
150
|
-
const ariaLabelledbyText = ariaLabelledbyTextOf();
|
|
151
|
-
if (isMeaningfulLabel(ariaLabelledbyText)) return ariaLabelledbyText;
|
|
152
|
-
|
|
153
|
-
if ('labels' in element && Array.isArray(Array.from(element.labels ?? []))) {
|
|
154
|
-
const labels = element.labels;
|
|
155
|
-
const firstLabel = labels && labels.length > 0 ? textOf(labels[0]) : '';
|
|
156
|
-
if (isMeaningfulLabel(firstLabel)) return firstLabel;
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
const text = textOf(element);
|
|
160
|
-
if (isMeaningfulLabel(text)) return text;
|
|
161
|
-
|
|
162
|
-
const nearestFieldLabel = isButtonLikeInput() ? undefined : nearestFieldLabelOf();
|
|
163
|
-
if (isMeaningfulLabel(nearestFieldLabel)) return nearestFieldLabel;
|
|
164
|
-
|
|
165
|
-
return syntheticLabelOf() || '';
|
|
166
|
-
};
|
|
167
|
-
|
|
168
|
-
return element.tagName.toLowerCase() + '|' + inferRole() + '|' + labelOf();
|
|
17
|
+
return (
|
|
18
|
+
element.tagName.toLowerCase() +
|
|
19
|
+
'|' +
|
|
20
|
+
observedInferRole(element) +
|
|
21
|
+
'|' +
|
|
22
|
+
observedLabelOf(element)
|
|
23
|
+
);
|
|
169
24
|
`;
|
|
170
25
|
function readLocatorDomSignatureInBrowser(element) {
|
|
171
26
|
return Function('element', LOCATOR_DOM_SIGNATURE_SCRIPT)(element);
|
|
172
27
|
}
|
|
173
28
|
const LOCATOR_BINDING_SNAPSHOT_SCRIPT = String.raw `
|
|
29
|
+
${OBSERVE_DOM_LABEL_CONTRACT_HELPER_SCRIPT}
|
|
174
30
|
if (!(element instanceof HTMLElement)) {
|
|
175
31
|
return null;
|
|
176
32
|
}
|
|
177
33
|
|
|
178
34
|
const read = Function('element', ${JSON.stringify(LOCATOR_DOM_SIGNATURE_SCRIPT)});
|
|
179
|
-
const
|
|
180
|
-
const role =
|
|
181
|
-
explicitRole ||
|
|
182
|
-
(element.tagName.toLowerCase() === 'select'
|
|
183
|
-
? 'combobox'
|
|
184
|
-
: element.tagName.toLowerCase() === 'textarea'
|
|
185
|
-
? 'textbox'
|
|
186
|
-
: element.tagName.toLowerCase() === 'input'
|
|
187
|
-
? 'textbox'
|
|
188
|
-
: '');
|
|
35
|
+
const role = observedInferRole(element);
|
|
189
36
|
const domSignature = read(element);
|
|
190
37
|
const label = typeof domSignature === 'string' ? domSignature.split('|').slice(2).join('|') : undefined;
|
|
191
38
|
return {
|
|
@@ -287,14 +134,8 @@ export async function readLocatorOuterHtml(locator) {
|
|
|
287
134
|
'track',
|
|
288
135
|
'wbr',
|
|
289
136
|
]);
|
|
290
|
-
const escapeText = (value) => value
|
|
291
|
-
|
|
292
|
-
.replace(/</g, '<')
|
|
293
|
-
.replace(/>/g, '>');
|
|
294
|
-
const escapeAttribute = (value) => value
|
|
295
|
-
.replace(/&/g, '&')
|
|
296
|
-
.replace(/"/g, '"')
|
|
297
|
-
.replace(/</g, '<');
|
|
137
|
+
const escapeText = (value) => value.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>');
|
|
138
|
+
const escapeAttribute = (value) => value.replace(/&/g, '&').replace(/"/g, '"').replace(/</g, '<');
|
|
298
139
|
const serializeChildren = (parent) => Array.from(parent.childNodes)
|
|
299
140
|
.map((node) => serializeNode(node))
|
|
300
141
|
.join('');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extract-scoped-dialog-text.d.ts","sourceRoot":"","sources":["../../src/commands/extract-scoped-dialog-text.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAuM5C,wBAAsB,oBAAoB,CAAC,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"extract-scoped-dialog-text.d.ts","sourceRoot":"","sources":["../../src/commands/extract-scoped-dialog-text.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAuM5C,wBAAsB,oBAAoB,CAAC,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAsB/F"}
|
|
@@ -196,10 +196,7 @@ export async function readScopedDialogText(page, selector) {
|
|
|
196
196
|
return null;
|
|
197
197
|
}
|
|
198
198
|
try {
|
|
199
|
-
const result = await page
|
|
200
|
-
.locator(selector)
|
|
201
|
-
.first()
|
|
202
|
-
.evaluate(readScopedDialogTextInBrowser, {
|
|
199
|
+
const result = await page.locator(selector).first().evaluate(readScopedDialogTextInBrowser, {
|
|
203
200
|
marker: BLOCK_MARKER,
|
|
204
201
|
anchorSelector: ANCHOR_SELECTOR,
|
|
205
202
|
minBlockTextLength: 20,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extract-snapshot-sanitizer.d.ts","sourceRoot":"","sources":["../../src/commands/extract-snapshot-sanitizer.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"extract-snapshot-sanitizer.d.ts","sourceRoot":"","sources":["../../src/commands/extract-snapshot-sanitizer.ts"],"names":[],"mappings":"AAuEA,wBAAgB,uBAAuB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAQhE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extract-stagehand-executor.d.ts","sourceRoot":"","sources":["../../src/commands/extract-stagehand-executor.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAI5C,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAC7B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAEnD,OAAO,EAA8B,KAAK,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAI9F,MAAM,MAAM,yBAAyB,GAAG,iBAAiB,GAAG;IAC1D,IAAI,EAAE,OAAO,CAAC;IACd,UAAU,EAAE,mBAAmB,CAAC;CACjC,CAAC;
|
|
1
|
+
{"version":3,"file":"extract-stagehand-executor.d.ts","sourceRoot":"","sources":["../../src/commands/extract-stagehand-executor.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAI5C,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAC7B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAEnD,OAAO,EAA8B,KAAK,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAI9F,MAAM,MAAM,yBAAyB,GAAG,iBAAiB,GAAG;IAC1D,IAAI,EAAE,OAAO,CAAC;IACd,UAAU,EAAE,mBAAmB,CAAC;CACjC,CAAC;AAiBF,wBAAsB,uBAAuB,CAAC,IAAI,EAAE;IAClD,OAAO,EAAE,aAAa,CAAC;IACvB,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,CAAC,CAAC,OAAO,CAAC;IAClB,IAAI,EAAE,IAAI,CAAC;IACX,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B,GAAG,OAAO,CAAC,yBAAyB,CAAC,CAsDrC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extract.d.ts","sourceRoot":"","sources":["../../src/commands/extract.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"extract.d.ts","sourceRoot":"","sources":["../../src/commands/extract.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAmMnD,wBAAsB,OAAO,CAC3B,OAAO,EAAE,aAAa,EACtB,UAAU,EAAE,MAAM,EAClB,QAAQ,CAAC,EAAE,MAAM,GAChB,OAAO,CAAC,IAAI,CAAC,CAkMf"}
|
package/dist/commands/extract.js
CHANGED
|
@@ -44,10 +44,14 @@ function describeSchema(descriptor, prefix) {
|
|
|
44
44
|
}
|
|
45
45
|
if (Array.isArray(value)) {
|
|
46
46
|
const itemDescriptor = value[0];
|
|
47
|
-
if (itemDescriptor === 'string' ||
|
|
47
|
+
if (itemDescriptor === 'string' ||
|
|
48
|
+
itemDescriptor === 'number' ||
|
|
49
|
+
itemDescriptor === 'boolean') {
|
|
48
50
|
lines.push(`${fieldPath}[]: ${itemDescriptor}`);
|
|
49
51
|
}
|
|
50
|
-
else if (typeof itemDescriptor === 'object' &&
|
|
52
|
+
else if (typeof itemDescriptor === 'object' &&
|
|
53
|
+
itemDescriptor !== null &&
|
|
54
|
+
!Array.isArray(itemDescriptor)) {
|
|
51
55
|
lines.push(...describeSchema(itemDescriptor, `${fieldPath}[]`));
|
|
52
56
|
}
|
|
53
57
|
else {
|
|
@@ -98,8 +102,23 @@ function canUseTargetAsExtractScope(target) {
|
|
|
98
102
|
'form',
|
|
99
103
|
'group',
|
|
100
104
|
]);
|
|
101
|
-
const leafInteractiveKinds = new Set([
|
|
102
|
-
|
|
105
|
+
const leafInteractiveKinds = new Set([
|
|
106
|
+
'input',
|
|
107
|
+
'textarea',
|
|
108
|
+
'select',
|
|
109
|
+
'option',
|
|
110
|
+
'button',
|
|
111
|
+
'link',
|
|
112
|
+
'combobox',
|
|
113
|
+
]);
|
|
114
|
+
const leafInteractiveRoles = new Set([
|
|
115
|
+
'textbox',
|
|
116
|
+
'combobox',
|
|
117
|
+
'option',
|
|
118
|
+
'menuitem',
|
|
119
|
+
'button',
|
|
120
|
+
'link',
|
|
121
|
+
]);
|
|
103
122
|
const iframeFieldLike = Boolean(target.framePath?.length) &&
|
|
104
123
|
(target.allowedActions.includes('fill') ||
|
|
105
124
|
target.allowedActions.includes('type') ||
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { Page } from 'playwright-core';
|
|
2
|
+
import type { DomObservedTarget } from './observe-inventory.js';
|
|
3
|
+
type ObserveAccessibilitySemantics = {
|
|
4
|
+
role?: string;
|
|
5
|
+
name?: string;
|
|
6
|
+
states?: Record<string, string | boolean | number>;
|
|
7
|
+
};
|
|
8
|
+
export type ObserveAccessibilityStats = {
|
|
9
|
+
axAttempts: number;
|
|
10
|
+
axHits: number;
|
|
11
|
+
fallbackUses: number;
|
|
12
|
+
};
|
|
13
|
+
type ObserveAccessibilityOptions = {
|
|
14
|
+
onStats?: (stats: ObserveAccessibilityStats) => void;
|
|
15
|
+
};
|
|
16
|
+
export declare function parseObserveAriaSnapshot(snapshot: string | undefined | null): ObserveAccessibilitySemantics | null;
|
|
17
|
+
export declare function enrichDomTargetsWithAccessibility(page: Page, targets: ReadonlyArray<DomObservedTarget>, options?: ObserveAccessibilityOptions): Promise<DomObservedTarget[]>;
|
|
18
|
+
export declare const __testObserveAccessibility: {
|
|
19
|
+
parseObserveAriaSnapshot: typeof parseObserveAriaSnapshot;
|
|
20
|
+
};
|
|
21
|
+
export {};
|
|
22
|
+
//# sourceMappingURL=observe-accessibility.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"observe-accessibility.d.ts","sourceRoot":"","sources":["../../src/commands/observe-accessibility.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAS5C,OAAO,KAAK,EAEV,iBAAiB,EAElB,MAAM,wBAAwB,CAAC;AAEhC,KAAK,6BAA6B,GAAG;IACnC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,GAAG,MAAM,CAAC,CAAC;CACpD,CAAC;AAOF,MAAM,MAAM,yBAAyB,GAAG;IACtC,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,KAAK,2BAA2B,GAAG;IACjC,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,yBAAyB,KAAK,IAAI,CAAC;CACtD,CAAC;AAyDF,wBAAgB,wBAAwB,CACtC,QAAQ,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,GAClC,6BAA6B,GAAG,IAAI,CAoDtC;AA+nBD,wBAAsB,iCAAiC,CACrD,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,aAAa,CAAC,iBAAiB,CAAC,EACzC,OAAO,CAAC,EAAE,2BAA2B,GACpC,OAAO,CAAC,iBAAiB,EAAE,CAAC,CAY9B;AAED,eAAO,MAAM,0BAA0B;;CAEtC,CAAC"}
|