File tree Expand file tree Collapse file tree 6 files changed +22
-10
lines changed
Expand file tree Collapse file tree 6 files changed +22
-10
lines changed Original file line number Diff line number Diff line change 11#!/usr/bin/python
2+ #!coding=utf-8
23
34import os
45import sys
56
7+ #卸载手机上的第三方应用
8+
69def uninstall ():
710 os .popen ("adb wait-for-device" )
811 print "start uninstall..."
Original file line number Diff line number Diff line change 1010def get_current_package_name ():
1111 pattern = re .compile (r"[a-zA-Z0-9\.]+/.[a-zA-Z0-9\.]+" )
1212 os .popen ("adb wait-for-device" )
13- out = os .popen ("adb shell dumpsys input | findstr FocusedApplication " ).read ()
13+ out = os .popen ("adb shell dumpsys window w | " + find_util + " \/ | " + find_util + " name= " ).read ()
1414 package_name = pattern .findall (out )[0 ].split ("/" )[0 ]
1515
1616 return package_name
Original file line number Diff line number Diff line change 11#!/usr/bin/python
2+ #!coding=utf-8
23
34import os
45import platform
56import re
67import sys
78
8- PATH = lambda p : os . path . abspath (
9- os . path . join ( os . path . dirname ( __file__ ), p )
10- )
9+ #获取设备当前界面的activity,保存至当前目录下的CurrentActivity.txt文件中
10+
11+ PATH = lambda p : os . path . abspath ( p )
1112
1213system = platform .system ()
1314if system is "Windows" :
1920
2021def get_activity ():
2122 os .popen ("adb wait-for-device" )
22- out = os .popen ("adb shell dumpsys input | " + find_util + " FocusedApplication " ).read ()
23+ out = os .popen ("adb shell dumpsys window w | " + find_util + " \/ | " + find_util + " name= " ).read ()
2324 return pattern .findall (out )[0 ]
2425
2526
Original file line number Diff line number Diff line change 1+ #!coding=utf-8
2+
13import os
24import tempfile
35import re
46
7+ #使用aapt获取设备上当前应用的apk信息,保存至当前目录下的PackageInfo.txt中
8+
59tempFile = tempfile .gettempdir ()
610
711def get_aapt ():
@@ -16,7 +20,7 @@ def get_aapt():
1620def get_current_package_name ():
1721 pattern = re .compile (r"[a-zA-Z0-9\.]+/.[a-zA-Z0-9\.]+" )
1822 os .popen ("adb wait-for-device" )
19- out = os .popen ("adb shell dumpsys input | findstr FocusedApplication " ).read ()
23+ out = os .popen ("adb shell dumpsys window w | findstr \/ | findstr name= " ).read ()
2024 package_name = pattern .findall (out )[0 ].split ("/" )[0 ]
2125
2226 return package_name
Original file line number Diff line number Diff line change 11#!/usr/bin/python
2+ #!coding=utf-8
23
34import os
45import platform
56import re
67import sys
78
8- PATH = lambda p : os . path . abspath (
9- os . path . join ( os . path . dirname ( __file__ ), p )
10- )
9+ #获取当前应用的包名,保存至当前目录下的PackageName.txt文件中
10+
11+ PATH = lambda p : os . path . abspath ( p )
1112
1213system = platform .system ()
1314if system is "Windows" :
1920
2021def get_package_name ():
2122 os .popen ("adb wait-for-device" )
22- out = os .popen ("adb shell dumpsys input | " + find_util + " FocusedApplication " ).read ()
23+ out = os .popen ("adb shell dumpsys window w | " + find_util + " \/ | " + find_util + " name= " ).read ()
2324 package_name = pattern .findall (out )[0 ].split ("/" )[0 ]
2425
2526 return package_name
Original file line number Diff line number Diff line change 11#!/usr/bin/env python
2+ #!coding=utf-8
23
34import os
45import time
56
7+ #截取设备上的屏幕,保存至当前目录下的screenshot目录
8+
69PATH = lambda p : os .path .abspath (p )
710
811def screenshot ():
You can’t perform that action at this time.
0 commit comments