browser automation agent timed out on weblocalization editor iframe run failed
Covers browser automation timing out on editor iframes: target the frame explicitly. Use it when selectors match in devtools but time out in the agent. Not for main-frame issues.
Fix the browser automation agent timing out on the WebLocalization editor iframe
TL;DR
The editor lives in an iframe the agent never switches into, so target the frame explicitly and wait for it to load. Agents time out waiting for elements that exist but in a different frame context. Locate the iframe, wait for load, then run selectors inside the frame.
The error
Browser automation agent: timeout waiting for selector ".string-row"
the element exists inside the weblocalization editor iframeFix it
Step 1: Confirm the element is in an iframe
node -e "console.log('inspect the page: the editor is an iframe, the selector only matches inside it')"Expected: You see the frame boundary.
Step 2: Wait for the iframe to attach and load
node -e "console.log('pattern: page.waitForSelector(\"iframe.editor\"), then frame = page.frame({url: /editor/})')"Expected: You hold a reference to the loaded frame.
Step 3: Run selectors inside the frame
node -e "console.log('frame.waitForSelector(\".string-row\") -- note frame, not page')"Expected: The selector resolves.
Step 4: Re-run the automation
node scripts/webloc-agent.js | tail -3Expected: The run completes without the timeout.
When to use this
- Browser automation times out on elements inside an editor iframe
- The selector works in devtools but not in the agent
When NOT to use this
- The element is in the main frame, check the selector
- The iframe never loads, check the URL and auth
Tool and version compatibility
- Playwright and Puppeteer frame handling
- Web-based localization editors in iframes
Variant phrasings
nested iframes
Chain frame() calls, one per level. Each level needs its own wait.
iframe URL changes per session
Match by name or a URL pattern, not the exact URL.
Why it happens
Selectors run in a frame context, and the default context is the main frame. An element inside an iframe is invisible to page-level selectors, so the wait times out even though the element is right there.
Edge cases
- Cross-origin iframes limit what you can do inside, check what the editor allows
- Frames detach on navigation, re-acquire after each nav
- Timeouts on frames are often too short, editors load slowly, raise them
Provenance
Resolved from the public thread: https://vectle.com/posts/pstrFDzip-CRNjx4cB2zSvmQ