Skip to content

Fix acceptAlertButtonSelector matching 'Don't Allow' instead of 'Allow'#24

Merged
omnarayan merged 1 commit intodevicelab-dev:mainfrom
maggialejandro:fix/accept-alert-button-selector
Feb 28, 2026
Merged

Fix acceptAlertButtonSelector matching 'Don't Allow' instead of 'Allow'#24
omnarayan merged 1 commit intodevicelab-dev:mainfrom
maggialejandro:fix/accept-alert-button-selector

Conversation

@maggialejandro
Copy link

@maggialejandro maggialejandro commented Feb 27, 2026

Summary

Fix the acceptAlertButtonSelector WDA setting that incorrectly matched "Don't Allow" buttons on iOS permission dialogs, causing permissions to be rejected instead of accepted on real devices.

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update
  • Refactoring (no functional changes)

Changes Made

  • Changed acceptAlertButtonSelector from CONTAINS[c] 'Allow' to BEGINSWITH[c] 'Allow' OR label ==[c] 'OK'
  • CONTAINS 'Allow' matched both "Allow" and "Don't Allow" buttons — WDA tapped the first match in the hierarchy, which was "Don't Allow"
  • BEGINSWITH 'Allow' correctly matches only "Allow" and "Allow While Using App"
  • Added ==[c] 'OK' fallback for older iOS dialogs that use "OK" instead of "Allow"

Related Issues

N/A

Testing

  • Tests pass locally (make test)
  • Linting passes (make lint)
  • Added tests for new functionality
  • Tested manually with sample flows

Checklist

  • Code follows project style guidelines
  • Self-reviewed the code
  • Added/updated documentation as needed
  • No breaking changes (or documented if breaking)
  • CHANGELOG.md updated (for notable changes)

Additional Notes

Reproduced on a real iOS device running an app that requests microphone permission. The setPermissions step with microphone: allow configured WDA's auto-alert handler, but the CONTAINS[c] 'Allow' predicate in the acceptAlertButtonSelector matched "Don't Allow" first, rejecting the permission dialog.

Screenshot 2026-02-27 at 3 28 08 PM

The CONTAINS[c] 'Allow' predicate matched both "Allow" and "Don't Allow"
buttons, causing WDA to tap "Don't Allow" and reject permissions on real
iOS devices. Changed to BEGINSWITH[c] 'Allow' to only match buttons
starting with "Allow", plus an exact match for "OK" on older iOS dialogs.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@maggialejandro maggialejandro force-pushed the fix/accept-alert-button-selector branch from 175f747 to 2f5d899 Compare February 27, 2026 18:27
@omnarayan
Copy link
Contributor

@maggialejandro nice catch! This one's sneaky — CONTAINS 'Allow' matching "Don't Allow" first is the kind of thing that can drive you crazy debugging on real devices.

BEGINSWITH is the right fix, and the OK fallback for older iOS dialogs is a nice touch. Thanks for the detailed write-up and screenshot too, super helpful.

@omnarayan omnarayan merged commit caad9ea into devicelab-dev:main Feb 28, 2026
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.

2 participants