【问题标题】:mCurrentFocus and mFocusedApp not returning detailsmCurrentFocus 和 mFocusedApp 不返回详细信息
【发布时间】:2020-09-18 09:44:26
【问题描述】:

我希望使用 Appium 设置一个 UI 自动化框架,但遇到了第一个障碍。我知道有不同的方法可以检索 appActivity 和 appPackage 详细信息,但想通过命令行尝试这种方式,以确保它们绝对是我在设置功能时使用的正确详细信息。

这导致了一个关于 Appium 的问题。我在使用我当前的 appPackage 和 appActivity 详细信息开始新会话时自动启动应用程序时遇到问题,这些详细信息是我使用真实设备通过 apk 详细信息应用程序获得的。 - 如果需要,我会将此作为单独的问题提出。

环境变量已设置为指向 sdk\platform-tools...。运行这些命令时,应用程序在模拟器上。

我尝试了不同的方法来检索应用程序详细信息,但均无济于事。我已经列出了命令行的输入/输出。

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:/ $

任何帮助将不胜感激:D

【问题讨论】:

    标签: sdk appium adb avd appium-android


    【解决方案1】:

    最好使用ActivityRecord 而不是mCurrentFocus

    • 窗户: adb shell dumpsys window windows | findstr ActivityRecord

    • Mac/Linux: adb shell dumpsys window windows | grep ActivityRecord

    【讨论】:

      【解决方案2】:

      试试这个:

      adb shell "dumpsys window | grep mCurrentFocus"
      

      【讨论】:

      • 请在您的答案中添加更多上下文。解释你在做什么以及为什么。
      【解决方案3】:

      感谢命令“dumpsys window | grep mCurrentFocus”有效。我能够看到当前的包和活动。 C:\Users\xxxx>adb 外壳 1|铍:/ $ dumpsys窗口| grep mCurrentFocus mCurrentFocus=Window{c941u12e u0 com.android.contacts/com.android.contacts.activities.TwelveKeyDialer}

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2018-11-10
        • 2014-07-17
        • 1970-01-01
        • 2016-10-27
        • 1970-01-01
        • 2022-08-22
        • 2019-04-10
        相关资源
        最近更新 更多