Skip to content

fix(wda): clear fields with typed backspaces on a simulator - #270

Merged
omnarayan merged 1 commit into
devicelab-dev:mainfrom
luka-vladika-happening-xyz:fix/wda-typed-clear-on-simulator
Nov 9, 2026
Merged

omnarayan merged 1 commit into
devicelab-dev:mainfrom
luka-vladika-happening-xyz:fix/wda-typed-clear-on-simulator

Conversation

@luka-vladika-happening-xyz

@luka-vladika-happening-xyz luka-vladika-happening-xyz commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

WebDriverAgent's first try at clearing a field (/element/{id}/clear, which eraseText uses) 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, so tapOn: "^10$" after an eraseText found 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: CreateSession sends useClearTextShortcut: false when the driver's device is a simulator (NewDriver sets it from PlatformInfo.IsSimulator), so WebDriverAgent types backspaces, and true on 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: TestCreateSession checks both: a client of a real device sends true, one whose driver is a simulator's sends false (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_validation flow: 0 of 3 before, 3 of 3 after, and the keyboard and its chips stay on screen after every eraseText. Real iPhones (iOS 18.3 to 27.2) keep the Clear key and pass as before.

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

codecov Bot commented Nov 8, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@omnarayan
omnarayan merged commit 050c15d into devicelab-dev:main Nov 9, 2026
5 checks passed
omnarayan added a commit that referenced this pull request Nov 12, 2026
markharding pushed a commit to futo-org/Harbor that referenced this pull request Nov 17, 2026
This PR contains the following updates:

| Package | Change | [Age](https://docs.renovatebot.com/merge-confidence/) | [Confidence](https://docs.renovatebot.com/merge-confidence/) |
|---|---|---|---|
| [maestro-runner](https://open.devicelab.dev/maestro-runner) ([source](https://github.com/devicelab-dev/maestro-runner)) | [`1.1.29` → `1.1.31`](https://renovatebot.com/diffs/npm/maestro-runner/1.1.29/1.1.31) | ![age](https://developer.mend.io/api/mc/badges/age/npm/maestro-runner/1.1.31?slim=true) | ![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/maestro-runner/1.1.29/1.1.31?slim=true) |

---

> ⚠️ **Warning**
>
> Some dependencies could not be looked up. Check the [Dependency Dashboard](issues/2097) for more information.

---

### Release Notes

<details>
<summary>devicelab-dev/maestro-runner (maestro-runner)</summary>

### [`v1.1.31`](https://github.com/devicelab-dev/maestro-runner/blob/HEAD/CHANGELOG.md#1131---2026-11-11)

[Compare Source](devicelab-dev/maestro-runner@v1.1.29...v1.1.31)

A fix release for 1.1.30, whose GitHub release was withdrawn. Everything listed under 1.1.30 below ships in 1.1.31. On top of it: WDA answers the permission prompts a flow does not tap (a 1.1.30 regression), taps after a check wait for the screen to settle, WDA page-source lookups on real iPhones are much faster, and a few smaller fixes.

##### Changed

**WDA: page-source lookups are much faster on real iPhones ([#&#8203;266](devicelab-dev/maestro-runner#266 A lookup that falls back to the page source (a selector not on screen yet, an optional step, `when: visible`, relative selectors, `index:`, `copyTextFrom`) now asks for it without the `visible` and `accessible` attributes, which WebDriverAgent computes for every element with an accessibility call each and the matcher never reads: on a heavy screen a page source went from about 25 s to 2.4 s. The report and the `hierarchy` command still get every attribute.

**WDA: `--wait-for-idle-timeout` above 0 no longer sends settings WebDriverAgent ignores ([#&#8203;267](devicelab-dev/maestro-runner#267 The value never changed anything on WDA: WebDriverAgent reads `shouldWaitForQuiescence` only when a session starts, takes `waitForIdleTimeout` in seconds, and every `launchApp` set it back to 0. On WDA only `0` has an effect, turning off the settle before each action, and the flag's help now says so.

##### Fixed

**WDA: a flow that taps one permission prompt's button still gets the other prompts answered ([#&#8203;264](devicelab-dev/maestro-runner#264), [#&#8203;265](devicelab-dev/maestro-runner#265 Since 1.1.30, a flow that taps a prompt's button itself (`tapOn: "Ask App Not to Track"`) turned off WDA's automatic answer for the whole session, so a later prompt the flow never meant to answer (notifications) stayed up over the app and every later step failed behind it. A lookup that finds nothing now answers such a prompt as WDA would have (`Allow…`, or `Don't Allow…` with `permissions: {all: deny}`) and looks again. The prompts the flow taps are still left to it, and a flow with `acceptAlert` or `dismissAlert` is unchanged.

**WDA: `kAXErrorServerNotFound` fails the step at once and says what it is ([#&#8203;268](devicelab-dev/maestro-runner#268 On real iPhones, after a `clearState` reinstall, the app sometimes runs without its accessibility server, and every page source fails with this error. A lookup polled to its timeout, each poll a page source of 8 to 10 s, and failed with "not visible within 30s", which read like a slow screen. The condition does not clear within a flow, so the step now fails at the first such read with "the app's accessibility server is not running (kAXErrorServerNotFound): WDA can reach the device but not the app; a relaunch does not help, restarting the device does".

**WDA: a tap after a check waits for the screen to settle ([#&#8203;269](devicelab-dev/maestro-runner#269 The driver settles before an action when the step before it may have moved the screen, but any other step cleared that, so a check or a script between two taps made the second tap skip it. When a tap opened a sheet, the check passed while the sheet was still sliding up (WebDriverAgent reports its final frame), and the next tap on the sheet went out mid-slide and was lost. A step that neither acts nor moves the screen (an assert, a script, a condition) now leaves it as it was.

**WDA: `eraseText` on a simulator no longer hides the keyboard for the rest of the run ([#&#8203;270](devicelab-dev/maestro-runner#270 WebDriverAgent cleared a field with a hardware keyboard's Clear key. On a simulator iOS then took a hardware keyboard as attached and kept the software keyboard off screen whenever a field had focus, so anything an app shows with the keyboard never appeared. On a simulator the field is now cleared with typed backspaces, as Maestro does; a real iPhone keeps the Clear key.

**DeviceLab iOS: `launchApp` with `stopApp: false` keeps the running app ([#&#8203;261](devicelab-dev/maestro-runner#261 The launch applied the default permissions first, and iOS kills an app whose permissions change, so the app restarted and lost its state. With `stopApp: false`, permissions and `clearKeychain` are no longer applied (a log line says so when the flow gives them).

**DeviceLab iOS: `hideKeyboard` no longer swipes on the keyboard while it is still sliding in.** The iOS agent took the screen size from the keyboard's frame. Right after a field took focus, that frame still lay below the screen, so the dismiss swipes started at the centre of a screen twice as tall: on the keys, where they dismiss nothing. Since 1.1.30 fails the step when the keyboard stays up ([#&#8203;259](devicelab-dev/maestro-runner#259)), flows that passed in 1.1.29 failed there (React Native's RNTester `text.yml` on iOS 27, 4 of 6 runs). The agent now reads the screen size from the app, waits for the keyboard to stop moving, and never starts the swipes below the keyboard.

##### Contributors

[@&#8203;luka-vladika-happening-xyz](https://github.com/luka-vladika-happening-xyz)

1. WDA answers the permission prompts a flow does not tap ([#&#8203;264](devicelab-dev/maestro-runner#264), [#&#8203;265](devicelab-dev/maestro-runner#265))
2. WDA lookups read the page source without `visible` and `accessible` ([#&#8203;266](devicelab-dev/maestro-runner#266))
3. WDA settles before a tap that follows a check ([#&#8203;269](devicelab-dev/maestro-runner#269))
4. WDA `eraseText` on a simulator keeps the keyboard on screen ([#&#8203;270](devicelab-dev/maestro-runner#270))
5. Reported `--wait-for-idle-timeout` doing nothing on WDA ([#&#8203;267](devicelab-dev/maestro-runner#267)) and `kAXErrorServerNotFound` ([#&#8203;268](devicelab-dev/maestro-runner#268))

[@&#8203;benalbrecht](https://github.com/benalbrecht)

1. DeviceLab iOS `launchApp` with `stopApp: false` keeps the running app ([#&#8203;261](devicelab-dev/maestro-runner#261))

[@&#8203;emil-doychev-bijenkorf](https://github.com/emil-doychev-bijenkorf)

1. Reported `copyTextFrom` ignoring a `childOf` anchor's index on 1.1.29 ([#&#8203;262](devicelab-dev/maestro-runner#262)), fixed by [#&#8203;241](devicelab-dev/maestro-runner#241) in 1.1.30

</details>

---

### Configuration

📅 **Schedule**: (UTC)

- Branch creation
  - "before 9am on tuesday"
- Automerge
  - At any time (no schedule defined)

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Mend Renovate CLI](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0NC4yMjcuNCIsInVwZGF0ZWRJblZlciI6IjQ0LjIyNy40IiwidGFyZ2V0QnJhbmNoIjoiZGV2ZWxvcCIsImxhYmVscyI6WyJkZXBlbmRlbmNpZXMiLCJyZW5vdmF0ZSJdfQ==-->

Reviewed-on: https://code.futo.org/harbor/harbor/pulls/2341
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.

3 participants