Skip to content

Fix uiautomator crash issue#676

Merged
mdshakib007 merged 1 commit intodevfrom
fix-uiautomator-crash-issue
Mar 13, 2026
Merged

Fix uiautomator crash issue#676
mdshakib007 merged 1 commit intodevfrom
fix-uiautomator-crash-issue

Conversation

@mahbd
Copy link
Collaborator

@mahbd mahbd commented Mar 12, 2026

PR Type

Bug Fix

PR Checklist

  • Tests for the changes have been added / updated.
  • Documentation comments have been added / updated.
  • A changelog entry has been made.
  • Version number has been updated.
  • Required modules have been added to respective "requirements*.txt" files.
  • Relevant Test Cases added to this description (below).
  • (Team) Label with affected action categories and semver status.

Overview

This PR resolves an issue where the uiautomator dump command execution via ADB was crashing the session when an active Appium driver was present for the device.

The fix introduces logic across three modified files to prioritize using the existing Appium driver's page_source property to capture the UI XML hierarchy instead of relying on ADB commands.

  1. Apps/Mobile/Android_Inspector_ZeuZ.py: The capture_ui_dump function now attempts to fetch page_source from an available Appium driver. If the driver is present and successfully retrieves the source, the ADB fallback (uiautomator dump) is skipped entirely, preventing the crash.
  2. Framework/Built_In_Automation/Mobile/Android/adb_calls/adbOptions.py: The check_if_device_is_unlocked function is updated to check for an associated Appium driver (based on serial or absence of serial) before executing adb exec-out uiautomator dump. If a driver is found, appium_driver.page_source is used instead of the ADB command.
  3. server/mobile.py: A new helper function, get_appium_driver_for_serial, is introduced to centralize logic for finding the correct Appium driver instance based on device serial or globally. This helper is used to update fetch_xml_and_screenshot and capture_ui_dump endpoints to use the Appium driver if available, thereby avoiding the problematic ADB call.

The core rationale is: If appium_driver is available, don't call uiautomator, otherwise it will crash.

Test Cases

  • No explicit test cases were referenced in the changes, but this addresses stability during UI inspection when Appium is managing the device session.

@mahbd mahbd marked this pull request as ready for review March 12, 2026 09:43
@mahbd mahbd self-assigned this Mar 12, 2026
@mahbd mahbd requested a review from mdshakib007 March 12, 2026 09:44
@mdshakib007 mdshakib007 merged commit a5fd647 into dev Mar 13, 2026
7 checks passed
@mdshakib007 mdshakib007 deleted the fix-uiautomator-crash-issue branch March 13, 2026 03:49
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