appium基礎架構

來源:互聯網
上載者:User

標籤:class   user   部分   .mm   result   alt   ppa   ppp   pycha   


 
 1 #-*-ecoding:utf-8 -*- 2 from appium import webdriver 3 from selenium.webdriver.support.wait import WebDriverWait 4 import unittest 5 from time import sleep 6 import time 7 import HTMLTestRunner 8 import io 9 10 class WebCat_Open(unittest.TestCase):11     def setUp(self):12         desired_caps={"platformName":"Android",13                 "platformVersion":"6.0",14                 "deviceName":"ZTEBV0710",15                 "appPackage":"com.tencent.mm",16                 "appActivity":"com.tencent.mm.ui.LauncherUI ",17                 "unicodeKeyboard":"true"}18         self.driver=webdriver.Remote("http://192.168.2.226:4723/wd/hub",desired_caps)19     def tearDown(self):20         self.driver.quit()21 22     def test_open(self):23         dr=self.driver24         qh=WebDriverWait(dr,10).until(lambda dr:dr.find_element_by_name(u"我"))25         qh.click()26         dr.find_element_by_name(u"設定").click()27         print(dr.current_context)28         print(dr.current_activity)29         sleep(10)30     def test_xy(self):31         pass32     def test_wc(self):33         pass34 35 unitsuits=unittest.defaultTestLoader.discover(start_dir=r"C:\Users\syf1225\PycharmProjects\appium",36                                              pattern="web*.py",37                                              top_level_dir=None)38 unitsuit=unittest.TestSuite()39 for suits in unitsuits:40     print(suits)41     for suit in suits:42         unitsuit.addTests(suit)43         print(suit)44 45 if __name__=="__main__":46     now = time.strftime("%y%m%d%H%M%S", time.localtime())47     filename = "C:\\Users\\syf1225\\PycharmProjects\\appium\\htmereport\\" + now+"result.html"48     file = open(filename, "wb")49     runner=HTMLTestRunner.HTMLTestRunner(stream=file,50                                          title=u"測試",51                                          verbosity=1,52                                          description=u"python指令碼,安卓6.0,windows10")53     runner.run(unitsuit)

 

以上代碼是做一些測試時用的,照著此代碼基本可以完成大部分基於UI的測試

appium基礎架構

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.