#啟動(dòng)一賬通登錄

import os,time,unittest,HtmlTestRunner

from appium import webdriver

PATH = lambda p:os.path.abspath(os.path.join(os.path.dirname(__file__),p))

global driver

class Login(unittest.TestCase):

? ? def setUp(self):

? ? ? ? desired_caps = {}

? ? ? ? desired_caps['platformName'] = 'Android'? # 設(shè)備系統(tǒng)

? ? ? ? desired_caps['platformVersion'] = '6.0.1'? # 設(shè)備系統(tǒng)版本

? ? ? ? desired_caps['deviceName'] = 'afa2ca98'? # 設(shè)備名稱

? ? ? ? # desired_caps['app'] = PATH(r"D:\Users\JKQSH-L0755>D:\Users\JKQSH-L0755\Desktop\yizhangtong-meizu_sd-release-5460016.apkyizhangtong-meizu_sd-release-546001.apk")

? ? ? ? desired_caps['appPackage'] = 'com.pingan.yzt'

? ? ? ? desired_caps['appActivity'] = 'com.pingan.yzt.SplashActivityPro'

? ? ? ? self.driver=webdriver.Remote("http://localhost:4723/wd/hub", desired_caps)

? ? def tearDown(self):#清理環(huán)境,最后執(zhí)行這一步

? ? ? ? self.driver.quit()

? ? def test_login(self):

? ? ? ? time.sleep(20)

? ? ? ? self.driver.find_element_by_id('tv_unlogin').click()

? ? ? ? time.sleep(10)

? ? ? ? self.driver.find_element_by_id('btn_login').click()

? ? ? ? name=self.driver.find_element_by_id('phone')

? ? ? ? name.click()

? ? ? ? name.send_keys('13248023252')

? ? ? ? psd=self.driver.find_element_by_id('password_et')

? ? ? ? psd.click()

? ? ? ? psd.send_keys("qweqwe123")

? ? ? ? blogin=self.driver.find_element_by_id('btn_login')

? ? ? ? blogin.click()

? ? ? ? time.sleep(10)

? ? if __name__=='__main__':

? ? ? ? unittest.main()

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容