Skip to content

feat(locator): form actions: clear, check, uncheck, isChecked, select… - #147

Merged
shossain786 merged 3 commits into
seleniumboot:masterfrom
PUSHPAK-JAISWAL:feat/locator-form-actions
Oct 12, 2026
Merged

shossain786 merged 3 commits into
seleniumboot:masterfrom
PUSHPAK-JAISWAL:feat/locator-form-actions

Conversation

@PUSHPAK-JAISWAL

Copy link
Copy Markdown
Contributor

What & why

Adds native form control actions directly to Locator:

  • clear(): waits for visibility and clears input text/value.
  • check(): idempotent; inspects checked state (isSelected() and aria-checked="true") and only clicks if not already checked.
  • uncheck(): idempotent; only clicks if currently checked.
  • isChecked(): non-waiting boolean query inspects checked state immediately, matching isVisible() and isEnabled().
  • selectOption(String text): selects a <select> option by its visible text via Selenium's Select.
  • selectOptionByValue(String value): selects a <select> option by its value attribute.
  • inputValue(): retrieves the form control's DOM value property (with fallback to the value attribute), returning "" if absent.

All terminal actions (clear, check, uncheck, selectOption, selectOptionByValue, inputValue) adhere to the PR #67/#68 contract: auto-waiting and re-resolving from scratch on each poll to survive stale or late-appearing elements up to timeouts.explicit.

Closes #133

Type of change

  • Bug fix
  • New feature (opt-in, aligned with the framework philosophy)
  • Documentation
  • Internal refactor / test coverage

Checklist

  • All existing tests pass (mvn clean verify / mvn test)
  • New behaviour is covered by unit tests
  • No new external dependencies introduced without prior discussion
  • Code follows existing conventions (no new frameworks, minimal abstraction)
  • No breaking changes to @SeleniumBootApi public APIs (or a major version bump is justified below)
  • Docs updated if user-facing behaviour changed (docs-site/)

Notes for reviewers

  • check() and uncheck() are idempotent: they avoid extra click actions and roundtrips if the element is already in the desired state. They also support ARIA checkboxes (role="checkbox" with aria-checked="true").
  • isChecked() is designed as a fast, non-waiting query method matching isVisible() and isEnabled(). For polling assertions, callers can continue using assertThat(locator).isChecked().
  • Added 22 unit and stale-element re-resolve tests in LocatorTest and LocatorStaleElementTest.

@shossain786
shossain786 merged commit 021d1c8 into seleniumboot:master Oct 12, 2026
2 checks passed
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.

feat(locator): form actions: clear, check, uncheck, isChecked, selectOption, inputValue

2 participants