chromeflow 0.3.0 → 0.4.0
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/CLAUDE.md +6 -1
- package/dist/tools/flow.js +19 -4
- package/package.json +1 -1
package/CLAUDE.md
CHANGED
|
@@ -194,7 +194,12 @@ set_file_input("Photos", "/path/2.jpg", verify_selector=".photo-thumbnail:nth-of
|
|
|
194
194
|
```
|
|
195
195
|
The page-level file count is reported in the response — use it to spot uploaders that consume-and-reset the input vs uploaders that keep the file there.
|
|
196
196
|
|
|
197
|
-
**Waiting for async results** (build, save, deploy): `wait_for_selector(selector, timeout)` — never poll with screenshots.
|
|
197
|
+
**Waiting for async results** (build, save, deploy): `wait_for_selector(selector, timeout)` — never poll with screenshots. `wait_for_selector` pierces open shadow roots, so a selector inside a web component (Outlier task UI, Lit/Stencil widget) matches without ceremony.
|
|
198
|
+
|
|
199
|
+
**Waiting for a shadow host's tree to attach** (e.g. SPA route flips where `<my-host>` appears 10s before its shadow content hydrates, and `wait_for_selector("my-host")` resolves while `host.shadowRoot` is still null): pass `shadow_root=true`. The wait then requires the matched element's `.shadowRoot` to be non-null, not just for the host element to exist.
|
|
200
|
+
```
|
|
201
|
+
wait_for_selector("iframe", shadow_root=true) — wait until the iframe both exists AND has an attached shadowRoot
|
|
202
|
+
```
|
|
198
203
|
|
|
199
204
|
**Waiting for an existing region to update** (e.g. click Save, then get the confirmation toast; send a chat message, then get the reply): `wait_for_change(selector)` uses a MutationObserver on the element's subtree and returns its new text content as soon as the mutation settles. Prefer this over `wait_for_selector` + `get_page_text` when the element already exists and you just need its next state — one call instead of two, no polling.
|
|
200
205
|
|
package/dist/tools/flow.js
CHANGED
|
@@ -92,7 +92,15 @@ If the click causes page navigation, this resolves when the new page finishes lo
|
|
|
92
92
|
Examples: wait for a build to finish, a success/error message to appear, a modal to open.
|
|
93
93
|
After it resolves, use get_page_text to read the result rather than taking a screenshot.
|
|
94
94
|
For long-running server-side processes (e.g. a query job that may take minutes), set poll_interval
|
|
95
|
-
to 15 seconds so the page is checked gently rather than hammered every 500ms
|
|
95
|
+
to 15 seconds so the page is checked gently rather than hammered every 500ms.
|
|
96
|
+
|
|
97
|
+
Pierces open shadow roots automatically \u2014 selectors for elements inside web components
|
|
98
|
+
(Outlier task UI, Lit/Stencil widgets) match without needing a shadow-DOM-aware caller.
|
|
99
|
+
|
|
100
|
+
Pass \`shadow_root: true\` when the matched element is itself a shadow host whose tree
|
|
101
|
+
hasn't attached yet \u2014 common after SPA route transitions where the host element appears
|
|
102
|
+
seconds before its shadow content hydrates. Without this, wait_for_selector("the-host")
|
|
103
|
+
resolves on the empty host and the next execute_script(host.shadowRoot) returns null.`,
|
|
96
104
|
{
|
|
97
105
|
selector: z.string().describe(
|
|
98
106
|
`CSS selector to wait for (e.g. '.deploy-ready', '[data-status="error"]', '.toast-error')`
|
|
@@ -100,14 +108,21 @@ to 15 seconds so the page is checked gently rather than hammered every 500ms.`,
|
|
|
100
108
|
timeout: z.number().optional().describe("Max seconds to wait (default 30)"),
|
|
101
109
|
poll_interval: z.number().optional().describe(
|
|
102
110
|
"How often to check for the selector, in seconds (default 0.5). Set to 15 when waiting for a slow server-side process."
|
|
111
|
+
),
|
|
112
|
+
shadow_root: z.boolean().optional().describe(
|
|
113
|
+
"If true, also require the matched element to have an attached shadowRoot (not null). Use after SPA navigations where the shadow host appears before its tree hydrates. Default false."
|
|
103
114
|
)
|
|
104
115
|
},
|
|
105
|
-
async ({ selector, timeout = 30, poll_interval }) => {
|
|
116
|
+
async ({ selector, timeout = 30, poll_interval, shadow_root }) => {
|
|
106
117
|
const timeoutMs = timeout * 1e3;
|
|
107
118
|
const pollMs = poll_interval ? poll_interval * 1e3 : void 0;
|
|
108
|
-
await bridge.request(
|
|
119
|
+
await bridge.request(
|
|
120
|
+
{ type: "wait_for_selector", selector, timeout: timeoutMs, refresh: pollMs, shadow_root },
|
|
121
|
+
timeoutMs + 5e3
|
|
122
|
+
);
|
|
123
|
+
const suffix = shadow_root ? " (with attached shadowRoot)" : "";
|
|
109
124
|
return {
|
|
110
|
-
content: [{ type: "text", text: `Selector "${selector}" found on page.` }]
|
|
125
|
+
content: [{ type: "text", text: `Selector "${selector}" found on page${suffix}.` }]
|
|
111
126
|
};
|
|
112
127
|
}
|
|
113
128
|
);
|
package/package.json
CHANGED