#!/usr/bin/env python
# _*_ coding:utf-8 _*_
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' # 设备系统
desired_caps['platformVersion'] = '6.0.1' # 设备系统版本
desired_caps['deviceName'] = 'afa2ca98' # 设备名称
# 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):#清理环境,最后执行这一步
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()
网友评论