关于appium+python里self.driver.tap([(x,y)])无效的原因
来源:互联网 发布:淘宝秒单软件 编辑:程序博客网 时间:2024/06/09 14:00
关于appium+python里self.driver.tap([(x,y)])无效的原因
今天写自动化,找不到元素点位,只能通过坐标去点击,于是使用tap去实现。
但是运行到tap的时候出错,提示找不到元素。去看了源码,发现并没有写错格式。
这里给个源码:
def tap(self, positions, duration=None): """Taps on an particular place with up to five fingers, holding for a certain time :Args: - positions - an array of tuples representing the x/y coordinates of the fingers to tap. Length can be up to five. - duration - (optional) length of time to tap, in ms :Usage: driver.tap([(100, 20), (100, 60), (100, 100)], 500) """ if len(positions) == 1: action = TouchAction(self) x = positions[0][0] y = positions[0][1] if duration: action.long_press(x=x, y=y, duration=duration).release() else: action.tap(x=x, y=y) action.perform() else: ma = MultiAction(self) for position in positions: x = position[0] y = position[1] action = TouchAction(self) if duration: action.long_press(x=x, y=y, duration=duration).release() else: action.press(x=x, y=y).release() ma.add(action) ma.perform() return self
最后觉得可能是页面还没跳转就实现了tap,所有加了一个WebDriverWait去判断元素存在,最后成功实现。
因为之前一直用的click(),click是识别元素才进行点击的,然而坐标信息是一直存在的,所以tap会直接运行,前面务必加上延时或者判断!!!
阅读全文
1 0
- 关于appium+python里self.driver.tap([(x,y)])无效的原因
- python里的self
- 关于Python(x,y)的安装以及spyder的安装
- 关于ios 里的self
- 关于python的self
- Python(x,y)正是我想要的
- 关于X开Y次方的算法
- 关于 UINT32 x:y的意义
- 关于X开Y次方的算法
- 关于max(X,Y),min(X,Y)
- Python(x,y)
- 接触Python(x,y)
- python(x,y)教程
- Python(x,y)安装
- 关于环境变量配置后无效的原因
- Python有趣的现象——x+=y VS x=x+y
- 关于X>Y和X Y的区别请看下面的html实例:
- 关于ax+by=c的解x,y的min(|x|+|y|)值问题
- hdu3533bfs+预处理
- 线程安全和非线程安全
- 通俗易懂的理解javascript闭包
- PHP一些基本的知识
- android usb转串及串口通信
- 关于appium+python里self.driver.tap([(x,y)])无效的原因
- 搜狐集团2018秋季校招笔试题 包裹问题
- dlib库学习之一
- MainWindow简介
- spring JSR303进行数据验证
- 14位IT高管及技术大牛谈Java的生态系统
- 第23讲项目1-被3或者5整除的数
- 简易版移动端智能家居前端实现--WEUI
- B