Description
The devicelab driver incorrectly maps Maestro's text: selector to Android UIAutomator's hintMatches() instead of textMatches(). This causes tapOn: "OK" and similar text-based selectors to fail when targeting standard Android dialog buttons (e.g., AlertDialog.setPositiveButton()), which have visible text but no hint attribute.
Error
When running a flow with --driver devicelab:
✗ tapOn: text="OK" (12.7s)
╰─ Element not found: handler_error: Element not found: -android uiautomator=new UiSelector().hintMatches("(?is).*\QOK\E.*")
The selector uses hintMatches() to search for "OK", but AlertDialog positive buttons have text "OK" (from android.R.string.ok), not a hint attribute.
Expected behavior
The text: selector should map to UiSelector().textMatches("(?is).*\\QOK\\E.*") (or similar text-based matching), consistent with how the default uiautomator2 driver handles it.
The default --driver uiautomator2 works correctly — it uses textMatches and successfully finds the button via tapOn: "OK".
Steps to reproduce
appId: any.app
---
# After any action that opens an AlertDialog with positive button:
- tapOn: "OK"
Run with:
maestro-runner --driver devicelab --platform android test flow.yaml
Environment
- maestro-runner version: 1.1.16
- Platform: android (SDK 31 emulator)
- Driver: devicelab
Workaround
Use --driver uiautomator2 (the default) instead of --driver devicelab, which correctly handles text-based selectors.
Description
The
devicelabdriver incorrectly maps Maestro'stext:selector to Android UIAutomator'shintMatches()instead oftextMatches(). This causestapOn: "OK"and similar text-based selectors to fail when targeting standard Android dialog buttons (e.g.,AlertDialog.setPositiveButton()), which have visible text but no hint attribute.Error
When running a flow with
--driver devicelab:The selector uses
hintMatches()to search for "OK", butAlertDialogpositive buttons have text "OK" (fromandroid.R.string.ok), not a hint attribute.Expected behavior
The
text:selector should map toUiSelector().textMatches("(?is).*\\QOK\\E.*")(or similar text-based matching), consistent with how the defaultuiautomator2driver handles it.The default
--driver uiautomator2works correctly — it usestextMatchesand successfully finds the button viatapOn: "OK".Steps to reproduce
Run with:
maestro-runner --driver devicelab --platform android test flow.yamlEnvironment
Workaround
Use
--driver uiautomator2(the default) instead of--driver devicelab, which correctly handles text-based selectors.