时钟 滑动 翻页 存在点循环
生活随笔
收集整理的這篇文章主要介紹了
时钟 滑动 翻页 存在点循环
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
# coding=utf-8import os
from runner.application.testcasebase import TestCaseBase
from runner.common.runnerlog import RunnerLog as Logger
from runner.application.device import DeviceManageclass MyTest(TestCaseBase):@classmethoddef setUpClass(cls):''' 測試case模塊初始化, 作用于整個測試周期'''cls.current_dir = os.path.dirname(__file__)cls.resource_path = os.path.join(os.path.dirname(os.path.dirname(cls.current_dir)),'resources')super(MyTest, cls).setUpClass()try:'''模塊初始化'''except Exception, e:Logger.error('MyTest module init failure: ' + str(e))@classmethoddef tearDownClass(cls):super(MyTest, cls).tearDownClass()try:'''模塊資源釋放'''except Exception, e:Logger.error('MyTest module clear resource failure: ' + str(e))def setUp(self):''' 測試case初始化,作用于單個測試方法'''super(MyTest, self).setUp()self.device = DeviceManage.getInstance().getTestDriver(0, self) # 初始化modeldef tearDown(self):super(MyTest, self).tearDown()Logger.info('清理添加城市數據')self.device.sleep(1)self.device.find_element_by_accessibility_id('添加的城市列表').click()while self.device.find_element_by_id('com.smartisanos.clock:id/my_view_group',ignoreExp = True):self.device.touch_action().press(x=150,y=400).wait(1).move_to(x=550,y=400).release().perform()self.device.sleep(1)self.device.find_element_by_accessibility_id('刪除').click()Logger.info('清理后臺')self.device.find_element_by_name('鬧鐘').click()self.device.open_recentApps() self.device.find_element_by_accessibility_id('全部清除').click()def test_Test(self):def clean_City():while self.device.find_element_by_id('com.smartisanos.clock:id/my_view_group',ignoreExp = True):self.device.touch_action().press(x=150,y=400).wait(1).move_to(x=550,y=400).release().perform()self.device.sleep(1)self.device.find_element_by_accessibility_id('刪除').click()Logger.info('時鐘取消城市搜索')'''1.清楚城市數據2.添加五個城市3.左滑城市4.右滑城市'''Logger.info('清楚城市數據')self.device.startApp('com.smartisanos.clock')self.device.find_element_by_name('世界時鐘').click()self.device.find_element_by_name('世界時鐘').click()if self.device.find_element_by_name('提示',ignoreExp = True): self.device.find_element_by_name('同意').click()if self.device.find_element_by_accessibility_id('添加的城市列表',ignoreExp = True): #原來城市左右滑格式排列self.device.find_element_by_accessibility_id('添加的城市列表').click()clean_City()if self.device.find_element_by_id('smartisanos:id/left_placeholder',ignoreExp = True): #原來城市上下滑格式排列 clean_City()Logger.info('添加五個城市')count = 1while count <= 10:self.device.find_element_by_accessibility_id('添加城市').click()city = self.device.find_elements_by_class_name('android.widget.LinearLayout')city[count].click()count += 2print countself.device.sleep(1)Logger.info('左滑城市')for i in range(6):self.device.pageLeft()Logger.info('右滑城市')for i in range(6):self.device.pageRight()
?
總結
以上是生活随笔為你收集整理的时钟 滑动 翻页 存在点循环的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: android 打开网络设置 异常,An
- 下一篇: 【笔记】Unity优化 基础知识