コード例 #1
0
 def locateElementByName(name):
     element = None
     try:
         element = AndroidTestDriver.initial().find_element_by_name(name)
         return True
     except Exception:
         logger.debug('Element with name %s cannot locate..' % name)
         getshots.getScreenShots()
         return False
     finally:
         return element
コード例 #2
0
 def locateElementByXpath(xpath):
     element = None
     try:
         element = AndroidTestDriver.initial().find_element_by_xpath(xpath)
         return True
     except Exception:
         logger.debug('Element with xpath %s cannot locate..' % xpath)
         getshots.getScreenShots()
         return False
     finally:
         return element
コード例 #3
0
 def locateElementsByClassName(classesName):
     element_list = None
     try:
         element_list = AndroidTestDriver.initial(
         ).find_elements_by_class_name(classesName)
         return True
     except Exception:
         logger.debug('Element list with className %s cannot locate..' %
                      classesName)
         getshots.getScreenShots()
         return False
     finally:
         return element_list
コード例 #4
0
 def locateElementsByUiAutomator(uiautomators):
     element_list = None
     try:
         element_list = AndroidTestDriver.initial(
         ).find_elements_by_android_uiautomator(uiautomators)
         return True
     except Exception:
         logger.debug('Element list with uiautomator %s cannot locate..' %
                      uiautomators)
         getshots.getScreenShots()
         return False
     finally:
         return element_list
コード例 #5
0
 def locateElementsById(elements_id):
     element_list = None
     try:
         element_list = AndroidTestDriver.initial().find_elements_by_id(
             elements_id)
         return True
     except Exception:
         logger.debug('Element list with id %s cannot locate..' %
                      elements_id)
         getshots.getScreenShots()
         return False
     finally:
         return element_list
コード例 #6
0
ファイル: minehistory.py プロジェクト: angelezhang/WaterDrip
def lookup_history():
    historyEls = LocatorController.locateElementsById('ad_cover')
    # pageFlag = LocatorController.locateElementById('tv_end_hint')
    pageFlag = False
    loopValue = 0
    if historyEls is True:
        while not pageFlag:
            while loopValue < 3:
                for element in historyEls:
                    element.click()
                    ActionController.delay(2)
                    for actionSwipe in range(0, 3):
                        ActionController.swipe_delta_y(round(2 / 3, 2),
                                                       round(4 / 5, 2),
                                                       round(2 / 5, 2))
                        YwfLog.warning(u'执行上滑操作..')
                        ActionController.delay(3)
                    ActionController.swipe_delta_x(round(1 / 5, 2),
                                                   round(2 / 5, 2),
                                                   round(3 / 5, 2))
                    YwfLog.warning(u'横滑返回..')
                    ActionController.delay(3)
                ActionController.swipe_delta_y(round(2 / 3,
                                                     2), round(4 / 5, 2),
                                               round(1 / 4, 2))
                YwfLog.warning(u'浏览列表..')
                ActionController.delay(3)
                loopValue += 1
            if loopValue == 3:
                pageFlag = True
    else:
        YwfLog.warning(u'浏览记录列表为空..')