fix(ios): use WebDriver Clear API for dynamic input fields #1568
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem
The previous
clearInputimplementation usedtripleTapon element coordinates, which failed with dynamic input fields like eBay's search box that shows a new input overlay when clicked.Root cause: When
aiInputwas called after the dynamic input appeared:clearInputusedtripleTapon those stale coordinatesSolution
Replaced the coordinate-based clearing approach with WebDriver's standard Clear API:
Benefits
✅ Works with dynamic input fields - Uses element references instead of coordinates
✅ No unwanted events - WebDriver's clear is an atomic operation
✅ W3C standard - Uses official WebDriver protocol
✅ Simpler code - Removed tripleTap and backspace fallbacks
Changes
packages/ios/src/ios-webdriver-client.tsAdded three new methods:
getActiveElement()- Get WebDriver ID of focused elementclearElement(elementId)- Clear element by IDclearActiveElement()- Combined method for easy usepackages/ios/src/device.tsSimplified
clearInput()to useclearActiveElement()Test files
Updated test files across platforms to use consistent search action descriptions
Testing
Tested with eBay's dynamic search box which previously failed consistently.
Note: This PR cherry-picks the changes from PR #1403 (merged to 1.0 branch) to the main branch.