获取app-package和app-activity的值

方法一

原文链接:http://mp.weixin.qq.com/s/KTkfmibSoaGOmDazJmZ8Sw

利用appium图形界面和已有的apk文件获取package和activity。

  1. 点击安卓图标;
  2. 选择apk文件的路径;
  3. package会显示此apk的package参数;
  4. launch activity会显示此apk启动时的activity参数;

方法二

原文链接:http://sqa.stackexchange.com/questions/12373/android-app-testing-with-appium/12382#12382

I suggest you to use adb (Android Debug Bridge) tool (part of Android SDK). So, install application under test on target Android device or emulator. And you should run application to get current activity and package name. So, after running app execute the following commands from command line (android-sdk/platform-tools/adb):

1 adb shell 
2 dumpsys window windows | grep -E 'mCurrentFocus|FocusedApp'

And you will get something like this:

mCurrentFocus=Window{43270790 u0 com.estrongs.android.pop/com.estrongs.android.pop.view.FileExplorerActivity} mFocusedApp=AppWindowToken{44d67b88 token=Token{435e5990 ActivityRecord{434ee320 u0 com.estrongs.android.pop/.view.FileExplorerActivity t133

So, current activity is com.estrongs.android.pop/.view.FileExplorerActivity and application package name is com.estrongs.android.pop is this case.

Steps:

  1. Install apk on device or emulator//安装待测apk。
  2. Run application//运行待测apk。
  3. Execute adb shell from command line//执行adb shell命令。
  4. Execute command to get current activity from device(shell) shell://执行下面命令。

    dumpsys window windows | grep -E 'mCurrentFocus|FocusedApp'

I hope it helps you.

转载于:https://www.cnblogs.com/superbaby11/p/6114182.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值