ValueKey to adopt Roveflow.
This page exists for the case where a scenario becomes fragile — multiple similar labels on the same screen, tightly dynamic copy, heavy i18n churn — and the report flags it. Adding a ValueKey on the offending widget makes future runs faster and more reliable, but it’s a tuning step, not a prerequisite.
When to reach for a key
Add a key when:- The report returns
"fragile": truefor a scenario that runs frequently. - A screen has multiple buttons with the same visible label.
- Copy churn keeps breaking a text-based waypoint.
- Read-only labels. The agent uses
tap_by_textor screenshots to verify. - Decorative icons that aren’t tap targets.
Where to key
Key the widgets a scenario actually drives:- Every primary call-to-action button referenced in a scenario.
- Every bottom navigation tab the agent navigates between.
- Every list item the agent selects — one key per row is overkill; key the list and use index-based finders, or key the per-item action button.
- Modal and bottom-sheet primary buttons used in cold-setup or recovery.
Naming convention
<lowercase_snake_case> describing the action or target:
login_button,email_field,password_fieldhome_tab,settings_tab,profile_tabopen_detail_button,confirm_buttondismiss_face_id_sheet,dismiss_notifications_sheet
Example: keying a bottom-nav tab
Example: keying a primary button
Declaring keys in a scenario
List the keys underpreferred_keys so the agent tries them before text or vision:
Verifying a key is reachable
With the app running in debug mode, in your Claude Code session:Tapped key "login_button". An error like widget with key "login_button" not found means the key isn’t in the current widget tree yet — wrong screen, or the code change hasn’t hot-reloaded.