Skip to content

refactor: Network extension to remove legacy command fallbacks#1258

Open
Dor-bl wants to merge 3 commits into
appium:masterfrom
Dor-bl:refactor/remove-network-fallback-7102057085996419728
Open

refactor: Network extension to remove legacy command fallbacks#1258
Dor-bl wants to merge 3 commits into
appium:masterfrom
Dor-bl:refactor/remove-network-fallback-7102057085996419728

Conversation

@Dor-bl

@Dor-bl Dor-bl commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

This pull request refactors the Android network extension in the Appium Python client to remove legacy MJSONWP (Mobile JSON Wire Protocol) code paths and dependencies, standardizing all network-related commands to use W3C WebDriver extension scripts. The code is simplified by removing fallback logic, unused imports, and direct command registrations. Corresponding unit tests are updated to reflect these changes.

Refactoring to W3C-only network commands:

  • Removed all fallback logic and dependencies related to MJSONWP commands in the Network class; now only W3C extension scripts are used for network operations such as getting/setting network connection, toggling WiFi, and setting network speed (appium/webdriver/extensions/android/network.py). [1] [2] [3] [4] [5] [6]

Code cleanup:

  • Removed unused imports and the CanRememberExtensionPresence mixin from the Network class, as well as command registration for legacy endpoints (appium/webdriver/extensions/android/network.py). [1] [2] [3]

Unit test updates:

  • Updated tests to remove references to MJSONWP endpoints and ensure assertions match the new W3C-only behavior, including checking the correct script and arguments are sent (test/unit/webdriver/network_test.py). [1] [2] [3]

Dor-bl and others added 3 commits July 20, 2026 21:04
Remove `try/except UnknownMethodException` fallback logic from `network_connection`, `set_network_connection`, `toggle_wifi`, and `set_network_speed` methods in the `Network` extension, relying solely on their corresponding `mobile:` scripts.

Also removes the inheritance from `CanRememberExtensionPresence`, unneeded imports, and clears `_add_commands` as these endpoints are now completely deprecated. Updates unit tests to remove mocks for legacy endpoints.
Remove `try/except UnknownMethodException` fallback logic from `network_connection`, `set_network_connection`, `toggle_wifi`, and `set_network_speed` methods in the `Network` extension, relying solely on their corresponding `mobile:` scripts.

Also removes the inheritance from `CanRememberExtensionPresence`, unneeded imports, and clears `_add_commands` as these endpoints are now completely deprecated. Updates unit tests to remove mocks for legacy endpoints.

Fixed ruff format issue.
execute_script's raw result doesn't match the method's documented int
return type; return self.network_connection after setting instead.
@linux-foundation-easycla

Copy link
Copy Markdown

CLA Not Signed

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.

3 participants