Skip to content

fix(webdriver): handle HTTP error responses and alert text in MobileErrorHandler - #1366

Open
hoanle0126 wants to merge 1 commit into
appium:masterfrom
hoanle0126:fix/errorhandler-http-and-alert-handling
Open

hoanle0126 wants to merge 1 commit into
appium:masterfrom
hoanle0126:fix/errorhandler-http-and-alert-handling

Conversation

@hoanle0126

Copy link
Copy Markdown
Contributor

Change list

Fix three error-handling gaps in MobileErrorHandler.check_response:

  • Raise WebDriverException (or the mapped subclass) whenever a response carries a non-zero error status (such as HTTP 401/502 plain-text or HTML proxy responses, flat JSON error objects without an outer value wrapper, or legacy JSONWP numeric status codes) instead of returning silently. Normal HTTP 200 responses and status 0 payloads remain unaffected.
  • Extract the alert prompt string from data.text (with fallback to string data or alert.text) when raising UnexpectedAlertPresentException, instead of passing the raw data dict as alert_text.
  • Support camelCase stackTrace frames and propagate screen captures when present in error payloads.

Added unit tests in test/unit/webdriver/errorhandler_test.py covering W3C, JSONWP, HTTP proxy/auth errors, unexpected alert text extraction, context exceptions, and mocked driver HTTP responses.

Types of changes

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Unit tests added/updated

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.

1 participant