Search code examples
sdkappiumadbandroid-virtual-deviceappium-android

mCurrentFocus and mFocusedApp not returning details


I'm looking to setup an UI automation framework using Appium and stuck at the first hurdle. I know there are different ways of retrieving appActivity & appPackage details but would like to try the way via command line to ensure they are definetly the correct details im using when setting up capabilities.

This leads onto an issue regarding Appium. I'm having trouble launching the app automatically when starting a new session with my current appPackage & appActivity details which i got via apk details app using a real device. - I will raise this as a separate issue if required.

Environment variables have been setup pointing to sdk\platform-tools.... And app is on emulator when running these commands.

I have tried different ways of retrieving the app details to no avail. I have listed input/outputs from command line.

C:\windows\system32>adb devices
List of devices attached
emulator-5554   device


C:\windows\system32>adb shell
generic_x86:/ $ dumpsys window windows | grep -E 'mCurrentFocus'
1|generic_x86:/ $ dumpsys window windows | grep -E 'mCurrentFocus'
1|generic_x86:/ $ exit

C:\windows\system32>adb shell "dumpsys window windows | grep -E 'mCurrentFocus|mFocusedApp'"

C:\windows\system32>adb shell "dumpsys window windows | grep -E 'mCurrentFocus|mFocusedApp'"

C:\windows\system32>adb shell
generic_x86:/ $ dumpsys window windows | grep -E 'mCurrentFocus|mFocusedApp'
1|generic_x86:/ $ dumpsys window windows | grep -E 'mCurrentFocus|mFocusedApp'
1|generic_x86:/ $

Any help would be much appreciated :D


Solution

  • try this:

    adb shell "dumpsys window | grep mCurrentFocus"