Use one day to organize Appium for Android documents. Portal
Use your spare time to skim through the data, Google. Baidu and so on to find, a strenuous effort, finally finally took the document.
is also the author of the recent study of their own summary of it, in fact, usually their own learning feeling is very simple, but suddenly let himself to organize
Feeling still difficult, thanks to their efforts, thanks to the official website, thanks to the tools, thank you for sharing it,
Learning process, always painful, thank those excellent forum, thank the predecessors of the guidelines, I hope you can more correct.
The code in this article is shown below.
From Appium import webdriverimport time,unittest,htmltestrunnerclass testlogin (unittest. TestCase): def setUp (self): self.desired_caps={} self.desired_caps[' platformname '] = ' Android ' sel f.desired_caps[' devicename ']= ' a6969 ' self.desired_caps[' preformversion "]= ' 5.0.2 ' self.desired_caps[' AppPacka GE '] = ' com.tencent.mobileqq ' self.desired_caps[' appactivity ' = '. Activity. Splashactivity ' Self.driver=webdriver. Remote (' Http://localhost:4723/wd/hub ', Self.desired_caps) Time.sleep (2) def tearDown (self): SELF.DRIVER.F ind_element_by_id (' Com.tencent.mobileqq:id/conversation_head '). Click () self.driver.find_element_by_id (' Com.tencent.mobileqq:id/settings '). Click () self.driver.find_element_by_id (' Com.tencent.mobileqq:id/account_ Switch '). Click () self.driver.find_element_by_id (' com.tencent.mobileqq:id/logoutbtn '). Click () Self.driver.fin d_element_by_id (' com.tencent.mobileqq:id/dialogrightbtn '). Click ()Self.driver.quit () def testLogin1 (self): self.driver.find_element_by_id (' Com.tencent.mobileqq:id/btn_login '). CLI CK () time.sleep (2) me=self.driver.find_element_by_android_uiautomator (' New Uiselector (). Text ("QQ number/Mobile number/email") Me.clear () Me.send_keys (' 319197149 ') password=self.driver.find_element_by_id (' Com.tencent.mobileqq:i D/password ') password.clear () Password.send_keys (' lileilei.930423 ') self.driver.find_element_by_id (' C Om.tencent.mobileqq:id/login '). Click () m=self.driver.find_element_by_id (' Com.tencent.mobileqq:id/conversation_ Head ') if M is not none:print (' login was sucess ') else:print (' login is Flase ') Print (self.driver.find_element_by_id (' Com.tencent.mobileqq:id/dialogtext '). Text) If __name__ = = ' __main__ ': suitete St = UnitTest. TestSuite () suitetest.addtest (Testlogin ("TestLogin1")) now=time.strftime ('%y-%m%d ', Time.localtime (Time.time ())) R Eport_dir= R '%s. html '%now re_open= open (Report_dir, ' WB ') Runner=htmltestrunner.htmltestrunner (stream=re_open,title= ' QQ test ', description= ' Test results ') Runner.run (suitetest)
Appium python andiroid Automated documentation to organize your notes.