[python]通过uiautomator实现返回当前程序包名

1 # -*- coding: utf-8 -*-
2 from uiautomator import device as d
3 
4 def getCurrentPackageName():
5     info = d.info
6     return info['currentPackageName']
7 
8 print getCurrentPackageName()

输出:

 1 com.android.settings 

执行时会根据当前手机所处在的程序进行获取包名

猜你喜欢

转载自www.cnblogs.com/51study/p/9396027.html