Skip to content

Conversation

@quanru
Copy link
Collaborator

@quanru quanru commented Nov 6, 2025

Summary

Add backward compatibility support for WebDriverAgent versions 5.x through 7.x in the iOS WebDriver client.

Key Changes

  • tap() method: Implements fallback from new endpoint (/wda/tap) to legacy endpoint (/wda/tap/0)
  • getScreenScale() method: Implements fallback from WDA endpoint to calculation-based approach using screenshot dimensions

Implementation Details

This implementation follows the Python facebook-wda library's compatibility approach:

  1. Primary attempt: Try the newer/recommended endpoint
  2. Fallback: On failure, automatically fall back to alternative methods
  3. No version detection: Self-adaptive compatibility without needing version checks

Compatibility Matrix

Method WDA 5.x WDA 6.x WDA 7.x Implementation
tap() /wda/tap/0 /wda/tap /wda/tap Try new, fallback to legacy
getScreenScale() /wda/screen /wda/screen /wda/screen Try endpoint, fallback to calculation

Test Coverage

Added comprehensive unit tests in ios-webdriver-client-compatibility.test.ts:

  • ✅ Fallback logic validation for both methods
  • ✅ All edge cases (null values, missing fields, errors)
  • ✅ Compatibility scenarios for WDA 5.x, 6.x, and 7.x
  • ✅ Error handling and graceful degradation

Breaking Changes

None - This change is fully backward compatible. All existing functionality is preserved.

References

🤖 Generated with Claude Code

Implemented fallback logic to support WebDriverAgent 5.x through 7.x:

- tap(): Tries new endpoint (WDA 6.0+) first, falls back to
  legacy endpoint (WDA 5.x)
- getScreenScale(): Tries /wda/screen endpoint first, calculates
  from screenshot if unavailable

This implementation follows Python facebook-wda's compatibility
approach with try-catch fallback strategy.

Changes:
- Enhanced tap() with dual-endpoint support
  (new: /wda/tap, legacy: /wda/tap/0)
- Enhanced getScreenScale() with calculation fallback using
  screenshot dimensions
- Added comprehensive unit tests covering all fallback scenarios
- All comments in English for consistency

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
@quanru quanru merged commit 0017b20 into 1.0 Nov 7, 2025
7 checks passed
@quanru quanru deleted the feat/ios-wda-5-7-compatibility branch November 7, 2025 05:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants