Appium driver.execute_script 不能点击 webview 的坐标吗?

crisy · March 19, 2014 · Last by wangjun replied at April 16, 2014 · 1324 hits

大家好,又遇到新问题了,呵呵。

起因,想点击一个 webview 上的图片,图片是通过滑动当前的 webview 得到的,不止一个。图片上有链接,点击后可以跳转。

用 driver.execute_script("mobile: tap", {"tapCount": 1, "touchCount": 1, "duration": 0.5, "x": 408, "y": 580 }) 语句进行点击,xy 的坐标肯定落在图片内的,但就是点不到,不知问题出在哪儿了?

PS: driver.execute_script("mobile: tap", {"tapCount": 1, "touchCount": 1, "duration": 0.5, "x": 408, "y": 580 }) 这种语句改下 xy 值,在其他页面点了一个 button 是能点到的。

共收到 4 条回复 时间 点赞
1Floor has deleted
2Floor has deleted

你用的是 selendroid 对吧。
不小心发重复了

crisy #4 · March 20, 2014 Author

是 uiautomator

#4 楼 @wangyemami uiautomator 在 4.4 版本之前不支持 webview 的控制。怀疑通过 uiautomator 发送的 event 到不了 webview, 你可也试试用 sendevent 或者其他 mr 点击下同样的坐标试试。

或者直接使用 selendroid, 就没事了

webveiw 测试必须使用 selendroid,然后可以使用 selenium/webdriver/commom/touch_actions.py 中的 Tap 接口实现点击。

需要 Sign In 后方可回复, 如果你还没有账号请点击这里 Sign Up