2015-04-22 52 views
0

如何使用appium/python/robot-framework滾動到android本機應用中頁面的底部?我曾嘗試以下方法,但不工作 driver.execute_script( 「window.scrollTo(144,1532)」)driver.execute_script( '移動:滾動',{ '時間':1, 'STARTX':48, 'startY':892, 'endX':144, '恩迪':1532})使用機器人框架在Android本機應用中滾動

回答

0

的appium庫應具有_touch.py​​文件控制滾動或 「揮動」

_touch.py​​

def swipe(self, start_x, start_y, end_x, end_y, duration=1000): 
    """ 
    Swipe from one point to another point, for an optional duration. 
    """ 
    driver = self._current_application() 
    driver.swipe(start_x, start_y, end_x, end_y, duration) 

def scroll(self, start_locator, end_locator): 
    """ 
    Scrolls from one element to another 
    Key attributes for arbitrary elements are `id` and `name`. See 
    `introduction` for details about locating elements. 
    """ 
    el1 = self._element_find(start_locator, True, True) 
    el2 = self._element_find(end_locator, True, True) 
    driver = self._current_application() 
    driver.scroll(el1, el2)