Test app launch/stop app via python call adb command

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.