Go to blog 77498935 Yipianfeng_ye's Special
#启动apkmessage = os.popen("adb shell am start -W -n com.qihoo.appstore/.home.MainActivity")for line in message.readlines(): if "ThisTime" in line: print(line.split(":")[1])
Import Os,timeClassApp():Def__init__(self,pagename,firstactivity):"" "Construction Method" "" Self.pagename = pagename self.firstactivty= firstactivity self.content=""#执行命令的文本 self.starttime=""#启动的时间DefStartApp(self):"" "Open App" "" "cmd ="ADB shell am start-w-n" +self.pagename+self.firstactivty self.content = Os.popen (cmd)def Stopapp (self): "" "Stop App" "" cmd = "adb shell am Force-stop" +self.pagename os.popen (cmd) def
getstarttime
(self): "" " Get Startup Time" "for line in self.content.readlines (): if " Thistime " In line:self.startTime = Line.split (":") [1] break return self.starttime
Test app launch/stop app via python call adb command