chromeflow 0.1.18 → 0.1.19
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/tools/flow.js +11 -4
- package/package.json +1 -1
package/dist/tools/flow.js
CHANGED
|
@@ -74,16 +74,23 @@ If the click causes page navigation, this resolves when the new page finishes lo
|
|
|
74
74
|
"wait_for_selector",
|
|
75
75
|
`Wait for a CSS selector to appear on the page. Use this instead of polling with take_screenshot.
|
|
76
76
|
Examples: wait for a build to finish, a success/error message to appear, a modal to open.
|
|
77
|
-
After it resolves, use get_page_text to read the result rather than taking a screenshot
|
|
77
|
+
After it resolves, use get_page_text to read the result rather than taking a screenshot.
|
|
78
|
+
Use the refresh parameter when results appear on the same page after a server-side process completes
|
|
79
|
+
(e.g. a query that runs asynchronously and updates the page when done) \u2014 the page will be reloaded
|
|
80
|
+
every N seconds until the selector appears.`,
|
|
78
81
|
{
|
|
79
82
|
selector: z.string().describe(
|
|
80
83
|
`CSS selector to wait for (e.g. '.deploy-ready', '[data-status="error"]', '.toast-error')`
|
|
81
84
|
),
|
|
82
|
-
timeout: z.number().optional().describe("Max seconds to wait (default 30)")
|
|
85
|
+
timeout: z.number().optional().describe("Max seconds to wait (default 30)"),
|
|
86
|
+
refresh: z.number().optional().describe(
|
|
87
|
+
"If set, reload the page every N seconds while waiting. Use when the result requires a server-side process to complete and the page won't update without a reload (e.g. waiting for a query job to finish)."
|
|
88
|
+
)
|
|
83
89
|
},
|
|
84
|
-
async ({ selector, timeout = 30 }) => {
|
|
90
|
+
async ({ selector, timeout = 30, refresh }) => {
|
|
85
91
|
const timeoutMs = timeout * 1e3;
|
|
86
|
-
|
|
92
|
+
const refreshMs = refresh ? refresh * 1e3 : void 0;
|
|
93
|
+
await bridge.request({ type: "wait_for_selector", selector, timeout: timeoutMs, refresh: refreshMs }, timeoutMs + 5e3);
|
|
87
94
|
return {
|
|
88
95
|
content: [{ type: "text", text: `Selector "${selector}" found on page.` }]
|
|
89
96
|
};
|
package/package.json
CHANGED