06:Android屏幕滑动

滑动,就是一个点移动另一个点。

用法:

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

        :Args:
         - start_x - x-coordinate at which to start
         - start_y - y-coordinate at which to start
         - end_x - x-coordinate at which to stop
         - end_y - y-coordinate at which to stop
         - duration - (optional) time to take the swipe, in ms.
        :Usage:
            driver.swipe(100, 100, 100, 400)
        """

获取手机分辨率

$ width = driver.get_window_size()['width']    #获取宽度
$ height = driver.get_window_size()['height']  #获取高度

屏幕左滑

$  driver.swipe(height/4*3,width/2,height/4,width/2,800)

屏幕右滑

$ driver.swipe(height/4,width/2,height/4*3,width/2,800)

屏幕下滑

$ driver.swipe(height/2,width/4,height/2,width/4*3,800)

屏幕上滑

$ driver.swipe(height/2,width/4*3,height/2,width/4,800)

本文作者原创,禁止转载。

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • Android 自定义View的各种姿势1 Activity的显示之ViewRootImpl详解 Activity...
    passiontim阅读 172,909评论 25 708
  • 《裕语言》速成开发手册3.0 官方用户交流:iApp开发交流(1) 239547050iApp开发交流(2) 10...
    叶染柒丶阅读 27,582评论 5 19
  • 屋外的风猎猎的刮着。因为想吃凉皮,便和永冒风前行,虽到了春季,但陡然的降温伴随着大风,还是有几分凉意四面袭来。永拥...
    瓦房听雨阅读 410评论 2 8
  • 一个人的圈子很大,大到他不说,你永远不知道他所有的朋友; 一个人的圈子很小,小到有些人你一辈子不想知道,有一天却怎...
    雪舞潇阳阅读 263评论 0 0
  • 真的不喜欢独立,有时候以为自己不是一个人了,只是对方的生活改变了,自己的生活却多了一件事,自己还是过着独立的生活。...
    李星谕阅读 519评论 0 50