标签:res 创建 ase str mobile div col cas key
import unittest import HTMLTestRunner import time from ios_login import driver # from appium.webdriver.common.mobileby import MobileBy ReferenceNumber="2072109" #require unique customerName="paul.wang" mobile="13138153397" Phone="029-88888888" emailadd="314424@qq.com" class addCustomers(unittest.TestCase): u"创建一个客户的测试用例" def setUp(self): pass def addCustomers(self): u"创建客户信息函数" driver.find_element_by_name("Bindo Payment").click() driver.implicitly_wait(60) driver.find_element_by_accessibility_id("nav side bar btn 20x20").click() driver.implicitly_wait(2) driver.find_element_by_accessibility_id("sidebar_customers").click() driver.implicitly_wait(1) driver.find_element_by_accessibility_id("blue plus 20x20").click() driver.implicitly_wait(1) driver.find_element_by_ios_predicate("value==‘Full Name‘").send_keys(customerName) #只有value值的时候可以用iOS谓词(谓词表达式为value的表达式)定位 # driver.find_element_by_ios_predicate("value==‘Mobile‘").send_keys(mobile) driver.find_element_by_ios_predicate("value==‘Reference Number‘").send_keys(ReferenceNumber) # driver.find_element_by_ios_predicate("value==‘Phone‘").send_keys(Phone) driver.find_element_by_ios_predicate("value==‘Gender‘").click() driver.find_element_by_accessibility_id("Male").click() driver.find_element_by_ios_predicate("value==‘Email‘").send_keys(emailadd) driver.find_element_by_ios_predicate("value==‘Special Discount‘").click() driver.find_element_by_accessibility_id("% Discount").click() # driver.find_element_by_accessibility_id("New Discount").click() driver.find_element_by_accessibility_id("Adsdsfa").click() driver.find_element_by_accessibility_id("Save").click() driver.implicitly_wait(60) driver.find_element_by_class_name("XCUIElementTypeSearchField").send_keys(customerName) driver.implicitly_wait(80) if(driver.find_element_by_name(customerName)==True): print("addCustomers succuss!!!" ) else: print("addCustomers fail!!") def tearDown(self): driver.quit() pass if __name__=="__main__": testsuite=unittest.TestSuite() testsuite.addTest(addCustomers(‘addCustomers‘)) #获取当前时间 now=time.strftime(‘%Y-%m-%d %H_%M_%S‘) #定义一个报告存放路径 filename=r‘report‘+now+‘result.html‘ fp=open(filename,‘wb‘) runner=HTMLTestRunner.HTMLTestRunner(stream=fp,title=u‘创建客户测试报告‘,description=u‘用例执行情况:‘) runner.run(testsuite) fp.close()
标签:res 创建 ase str mobile div col cas key
原文地址:https://www.cnblogs.com/paul-wang/p/9876918.html