chromeflow 0.1.33 → 0.1.35
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 +34 -0
- package/dist/tools/browser.js +2 -2
- package/dist/tools/flow.js +1 -1
- package/package.json +1 -1
package/CLAUDE.md
CHANGED
|
@@ -149,4 +149,38 @@ screenshot to check what happened.
|
|
|
149
149
|
|
|
150
150
|
**Waiting for async results** (build, save, deploy): `wait_for_selector(selector, timeout)` — never poll with screenshots.
|
|
151
151
|
|
|
152
|
+
**React Select / custom styled dropdowns** (e.g. "Select..." components on DataAnnotation):
|
|
153
|
+
`click_element` and `fill_input` do NOT work on these — they intercept native events. Use
|
|
154
|
+
`execute_script` directly:
|
|
155
|
+
|
|
156
|
+
```js
|
|
157
|
+
// 1. Open the menu — click the control div (filter by pageY if multiple)
|
|
158
|
+
var controls = document.querySelectorAll('[class*="control"]');
|
|
159
|
+
controls[N].click();
|
|
160
|
+
|
|
161
|
+
// 2. Pick an option by exact text
|
|
162
|
+
var allEls = document.querySelectorAll('*');
|
|
163
|
+
for (var i = 0; i < allEls.length; i++) {
|
|
164
|
+
if (allEls[i].textContent.trim() === 'Target Option' && allEls[i].children.length === 0) {
|
|
165
|
+
allEls[i].dispatchEvent(new MouseEvent('mousedown', {bubbles: true}));
|
|
166
|
+
allEls[i].click();
|
|
167
|
+
break;
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
// 3. Verify
|
|
172
|
+
controls[N].textContent.trim(); // should show selected value
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
**Page content rendered as images** (e.g. qualification "Examples" tabs that show PNG screenshots
|
|
176
|
+
instead of DOM text): `get_page_text()` returns nothing useful. Zoom out and screenshot instead:
|
|
177
|
+
|
|
178
|
+
```js
|
|
179
|
+
// Shrink to fit wide content, then screenshot
|
|
180
|
+
document.body.style.zoom = '0.4';
|
|
181
|
+
// use take_and_copy_screenshot() to read it
|
|
182
|
+
// restore afterward:
|
|
183
|
+
document.body.style.zoom = '1';
|
|
184
|
+
```
|
|
185
|
+
|
|
152
186
|
**Never use Bash to work around a stuck browser interaction.**
|
package/dist/tools/browser.js
CHANGED
|
@@ -6,7 +6,7 @@ import { execSync } from "child_process";
|
|
|
6
6
|
function registerBrowserTools(server, bridge) {
|
|
7
7
|
server.tool(
|
|
8
8
|
"open_page",
|
|
9
|
-
"Navigate to a URL. By default reuses the active tab. Set new_tab=true to open alongside the current tab without losing it.",
|
|
9
|
+
"Navigate to a URL. By default reuses the active tab. Set new_tab=true to open alongside the current tab without losing it. After navigating, call get_page_text to read the page \u2014 do NOT take a screenshot.",
|
|
10
10
|
{
|
|
11
11
|
url: z.string().url().describe("The URL to navigate to"),
|
|
12
12
|
new_tab: z.boolean().optional().describe("Open in a new tab instead of replacing the current one (default false)")
|
|
@@ -50,7 +50,7 @@ ${lines.join("\n")}` }]
|
|
|
50
50
|
);
|
|
51
51
|
server.tool(
|
|
52
52
|
"take_screenshot",
|
|
53
|
-
"Capture a screenshot
|
|
53
|
+
"Capture a screenshot of the current page. IMPORTANT: Do NOT use this to read page content or check what is on the page \u2014 call get_page_text instead, which is faster and returns searchable text. Screenshots are ONLY for locating a specific element's pixel coordinates when get_elements has already failed. Never take a screenshot immediately after open_page, scroll_page, or click_element \u2014 always use get_page_text after those actions. Never take more than 1-2 screenshots in a row. To also save or copy the image, use take_and_copy_screenshot instead.",
|
|
54
54
|
{},
|
|
55
55
|
async () => {
|
|
56
56
|
const response = await bridge.request({ type: "screenshot" });
|
package/dist/tools/flow.js
CHANGED
|
@@ -2,7 +2,7 @@ import { z } from "zod";
|
|
|
2
2
|
function registerFlowTools(server, bridge) {
|
|
3
3
|
server.tool(
|
|
4
4
|
"scroll_page",
|
|
5
|
-
"Scroll the page or the focused panel up or down. Use this when the target location is unknown. If you know which field or element you need, use scroll_to_element instead \u2014 it scrolls precisely without guessing. After scrolling,
|
|
5
|
+
"Scroll the page or the focused panel up or down. Use this when the target location is unknown. If you know which field or element you need, use scroll_to_element instead \u2014 it scrolls precisely without guessing. After scrolling, call get_page_text to read the new content \u2014 NEVER call take_screenshot after scrolling.",
|
|
6
6
|
{
|
|
7
7
|
direction: z.enum(["down", "up"]).describe("Scroll direction"),
|
|
8
8
|
amount: z.number().optional().describe("Pixels to scroll (default 400)")
|
package/package.json
CHANGED