Repository navigation
fix(wda): clear fields with typed backspaces on a simulator - #270
Merged
omnarayan merged 1 commit intoNov 9, 2026
Conversation
WebDriverAgent's first try at clearing a field is a hardware keyboard's Clear key (an IOHIDEvent). On a simulator iOS then takes a hardware keyboard as attached and keeps the software keyboard parked below the screen whenever a field has focus, so what an app shows with the keyboard (a betslip's stake chips) never appears. A simulator's session now sets useClearTextShortcut false: typed backspaces, as Maestro erases. A real iPhone keeps its keyboard up after the Clear key, and typed backspaces erase only what is left of the cursor: a tap in the middle of a one-digit field put the cursor before the digit about half the time, and nothing was erased. A real device's session sets it true. It is sent either way, since WebDriverAgent keeps settings process-wide.
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
omnarayan
added a commit
that referenced
this pull request
Nov 12, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
WebDriverAgent's first try at clearing a field (
/element/{id}/clear, whicheraseTextuses) is a hardware keyboard's Clear key, an IOHIDEvent (useClearTextShortcut, on by default; its comment cites appium/appium#19389). On a simulator iOS then takes a hardware keyboard as attached, and from then on keeps the software keyboard parked below the screen whenever a field has focus (its frame at y = 891 on an 874-point screen). Whatever an app shows with the keyboard never appears: in our suite the betslip's stake chips, sotapOn: "^10$"after aneraseTextfound nothing for the rest of the run. Neither DeviceLab's driver nor Maestro sends such an event; Maestro erases by typing delete characters.The change:
CreateSessionsendsuseClearTextShortcut: falsewhen the driver's device is a simulator (NewDriversets it fromPlatformInfo.IsSimulator), so WebDriverAgent types backspaces, andtrueon a real device. It sends it either way, since WebDriverAgent keeps settings for the whole process.Why not on a real iPhone too: a phone keeps its software keyboard up after the Clear key, and typed backspaces erase only what is left of the cursor. Our stake field is as wide as its text (9 pt for "3"); a tap in its middle can put the cursor before the digit, and then nothing is erased (WebDriverAgent's last try, a triple tap, only opens the edit menu there, and the clear reports success). With backspaces on five real iPhones, our two flows that change a stake missed an erase in 6 of 8 runs on the two iOS 27 phones and in none of 12 on the iOS 18 and 26 phones; with the Clear key, in none of 30, and none of 192 erases to empty missed in a probe that erases the stake six times a run (96 with this change, 96 without).
Tests:
TestCreateSessionchecks both: a client of a real device sendstrue, one whose driver is a simulator's sendsfalse(fails without the change).go test -race ./pkg/driver/wda/ ./pkg/executor/ ./pkg/flow/passes; golangci-lint v2.13.2: 0 issues.On devices: a simulator (iOS 27.2), our
betslip_stake_validationflow: 0 of 3 before, 3 of 3 after, and the keyboard and its chips stay on screen after everyeraseText. Real iPhones (iOS 18.3 to 27.2) keep the Clear key and pass as before.