Skip to content

Conversation

@MarcinDudekDev
Copy link

Summary

Add two new client methods to simplify working with iframes (Stripe, PayPal, embedded widgets):

  • findInFrames(name, selector, options) - Searches all frames (main + nested) for an element. Returns the element, frame reference, and debug info. Auto-detects Stripe/PayPal iframes in the frame info.

  • fillForm(name, fields, options) - Smart form filling that finds fields by label, name, placeholder, or aria-label across all frames. Supports auto-submit option.

Problem

When automating payment forms or embedded widgets, selectors often work in DevTools but fail in Playwright scripts because the element is inside an iframe. Manually iterating through page.frames() is tedious and error-prone.

Solution

These helpers abstract away the frame iteration logic:

// Before: manual frame iteration for (const frame of page.frames()) { try { const el = await frame.waitForSelector('input[name="cardnumber"]', { timeout: 500 }); if (el) { /* found it */ } } catch { /* not in this frame */ } } // After: one-liner const { element, frameInfo } = await client.findInFrames("checkout", 'input[name="cardnumber"]');

Test plan

  • TypeScript compiles without errors
  • Existing tests pass (bun test - 9 tests pass)
  • Manual test: findInFrames finds elements in main frame
  • Manual test: findInFrames finds elements in iframes
  • Manual test: fillForm fills fields across main frame and iframes
  • Documentation added to SKILL.md

🤖 Generated with Claude Code

Add two new client methods to simplify working with iframes (Stripe, PayPal, etc.): - findInFrames(name, selector, options): Searches all frames for an element, returns the element, frame, and debug info. Detects Stripe/PayPal iframes. - fillForm(name, fields, options): Smart form filling that finds fields by label, name, placeholder, or aria-label across all frames. Supports auto-submit option. These helpers solve the common pain point where selectors work in DevTools but fail in scripts because the element is in an iframe. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant