Skip to content

fix(SKY-12019): guard clear/fill actions from targeting non-editable elements#7164

Draft
AronPerez wants to merge 1 commit into
mainfrom
sky-12019-guard-clearfill-actions-from-targeting-hcaptcha-iframes-db1d
Draft

fix(SKY-12019): guard clear/fill actions from targeting non-editable elements#7164
AronPerez wants to merge 1 commit into
mainfrom
sky-12019-guard-clearfill-actions-from-targeting-hcaptcha-iframes-db1d

Conversation

@AronPerez

Copy link
Copy Markdown
Contributor

Description

The action planner occasionally selects a non-editable element — such as an hCaptcha iframe — as the target for an INPUT_TEXT action. Execution then attempted Locator.clear/Locator.fill on that iframe, which failed mid-step.

This adds an editable-element guard so clear/fill only target valid text inputs:

  • New SkyvernElement.supports_text_input() — true for input/textarea/select, Playwright-editable elements, or contenteditable elements.
  • handle_input_text_action now rejects the action up front with InvalidElementForTextInput when the target isn't editable, before any clear/fill attempt (so an iframe target fails cleanly instead of erroring inside Locator.clear).

The existing non-editable fill path only fired for contenteditable elements Playwright doesn't report as editable, which the new guard still permits; truly non-editable targets (iframes, plain divs) would have thrown from Playwright anyway and now get a clear error instead.

How Has This Been Tested?

Added tests/unit/test_input_text_iframe_guard.py:

  • supports_text_input() unit cases: iframe → rejected; input/textarea/select and editable/contenteditable → accepted; contenteditable="false" → rejected.
  • Handler-level regression: an INPUT_TEXT action targeting an iframe returns ActionFailure(InvalidElementForTextInput) and never calls input_clear/input_fill.

(pytest isn't installed in this sandbox, so the suite wasn't executed here — CI should run it.)

…elements

The planner occasionally selected a non-editable element (e.g. an hCaptcha
iframe) as the target for an INPUT_TEXT action. Execution then attempted
Locator.clear/fill on the iframe, failing the step.

Add SkyvernElement.supports_text_input() (input/textarea/select, Playwright
editable, or contenteditable) and reject INPUT_TEXT up front with
InvalidElementForTextInput when the target isn't editable, before any
clear/fill attempt.

Generated with [Linear](https://linear.app/skyvern/issue/SKY-12019/guard-clearfill-actions-from-targeting-hcaptcha-iframes#agent-session-5326e368)

Co-authored-by: linear-code[bot] <222613912+linear-code[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant