# -*- coding: utf-8 -*- from appium import webdriver#倒入 webdriver def changeListTree(listTree): listTreeName = [] if len(listTree) > 0 : for i in listTree: listTreeName.append(i.text) return listTreeName def listIsDif(newListName,oldListName): # newListName = changeListTree(newList) # oldListName = changeListTree(oldList) # newListName中有而oldListName中没有的 difListName = list(set(newListName).difference(set(oldListName))) print '不同路径的长度',len(difListName) for i in difListName: print i return difListName def listQD(onelist): newlist = [] for i in onelist: if not i in newlist: newlist.append(i) for i in newlist: print i def listD(newList,oldList): for iold in oldList: for inew in newList: if iold == inew: newList.remove(inew) for i in newList: print i return newList list1 =['财务中心','运营中心'] list2 =['特别关注','我的客服','我的单位','浙江万赛软件集团(筹)','总裁办', '综合办', '财务中心', '运营中心'] list4 =['浙江万赛软件集团(筹)','总裁办', '综合办', '财务中心', '运营中心','研发中心','质管中心','丽水万赛','云南万赛', '宁夏万赛', '测试账号'] if len(listD(list1,list2)) == 0: print 'ok' # # class apptestlogin(unittest.TestCase): # def setUp(self):#初始化 # self.desired_caps={} # self.desired_caps['platformName'] = 'Android' # self.desired_caps['deviceName']='7bbe99db' # self.desired_caps['preformVersion']='4.3' # self.desired_caps['appPackage'] ='com.tencent.mobileqq' # self.desired_caps['appActivity'] ='.activity.SplashActivity' # self.driver=webdriver.Remote('http://localhost:4723/wd/hub', self.desired_caps)#启动 app # self.driver.implicitly_wait(1) # 全局方法最长超时时间 # # def tearDown(self):#还原测试环境 # self.driver.find_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.find_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').click()#登录,定位方式 id # # time.sleep(2) # me = self.driver.find_element_by_android_uiautomator('new UiSelector().textContains("QQ")')# 定位输入qq号,使用uiautomator定位 # me.clear() # 输入框输入前最好先清空下 # me.send_keys('121354090') # password = self.driver.find_element_by_id('com.tencent.mobileqq:id/password') # password.clear() # password.send_keys('xxx..') # self.driver.find_element_by_id('com.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 is sucess') # else: # print('login is Flase') # print(self.driver.find_element_by_id('com.tencent.mobileqq:id/dialogText ').text) # # if __name__ == '__main__': # suiteTest = unittest.TestSuite() # suiteTest.addTest(apptestlogin("testLogin1")) # unittest.TextTestRunner(verbosity=1).run(suiteTest) # # now = time.strftime('%Y-%m%d', time.localtime(time.time())) # # report_dir = r'%s.html' % now # # re_open = open(report_dir, 'wb') # # runner = HTMLTestRunner.HTMLTestRunner(stream=re_open, title = 'QQ 测试', description = '测试结果') # # runner.run(suiteTest)