使用机器人框架滚动Android Native应用程序

时间:2015-04-22 00:56:35

标签: android python appium robotframework

如何使用appium / python / robot-framework滚动到android native app中的页面底部?我尝试过以下方法,但不起作用 driver.execute_script(“window.scrollTo(144,1532)”) driver.execute_script('mobile:scroll',{'duration':1,'startX':48,'startY':892,'endX':144,'endY':1532}) < / p>

1 个答案:

答案 0 :(得分: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)