查找当前应用activity方法
1 、cmd窗口中执行“adb logcat -v time -s ActivityManager > d:\log.txt” 抓logcat ,进入相应的activity logcat 将信息保存在D盘log.txt文件中
2、self.driver.current_activity(appium方法)
3、adb shell dumpsys window | findstr mCurrentFocus
下面介绍通过adb shell dumpsys命令获得activity
cmd窗口中执行adb shell dumpsys window -h,显示如下帮助内容:
C:\Users\xxxxx>adb shell dumpsys window -h
Window manager dump options:
[-a] [-h] [cmd] ...
cmd may be one of:
l[astanr]: last ANR information
p[policy]: policy state
a[animator]: animator state
s[essions]: active sessions
d[isplays]: active display contents
t[okens]: token list
w[indows]: window list
cmd may also be a NAME to dump windows. NAME may
be a partial substring in a window name, a
Window hex object identifier, or
"all" for all windows, or
"visible" for the visible windows.
-a: include all available server state.
输入:C:\Users\liumei03>adb shell dumpsys window w | findstr mCurrent
返回: mCurrentFocus=Window{529dc4dc u0 com.android.deskclock/com.android.deskclock.DeskClock}