Appium iOS 系统弹窗无法处理且触屏手势也无法实现

HengXin · 2014年02月24日 · 最后由 深圳-Max 回复于 2015年02月13日 · 1619 次阅读

使用环境:
Appium 0.15.0
OS X 10.9.1
Xcode 5.0.2
Python 2.7
iPhone Simulator 7.0.3

目前正在使用 Appium+Selenium+Webdriver+Python 进行 iOS 上的 App 的自动化测试。

  1. 目前遇到系统弹窗无法确认的问题。通常自己的软件内部 xpath 定位都在//Window[1] 上面且均能定位和操作。唯独 iOS 的系统弹窗 Would you like to Access Your Photos?[Don't Allow/OK] 两个按钮在 Inspector 的 xpath 定位都显示的是相同路径"//window[4]/alert[1]/tableview[2]/cell[1]"。且运行时直接报错为'An element could not be located on the page using the given search parameters.'

  2. 使用 selenium.webdriver.common.touch_actions 中的 tap_and_hold,double_tap 之类的方法,Appium 都显示为'WebDriverException: Message: u'Not yet implemented. Please help us: http://appium.io/get-involved.html''

请问各位有遇到类似的问题的吗,知道有另外的解决方法吗?

共收到 8 条回复 时间 点赞

目前找到解决方案了,详见https://github.com/appium/appium/commit/9515df987fdaadfee73d8ffd47eed43c16a9a2c6
以下是我执行成功的 python 代码片段:
self.driver.execute_script('mobile: swipe', {'touchCount':'1', 'startX':'0', 'startY':'0', 'endX':'266', 'endY':'399', 'duration':'0.8', 'element':element.id})
注意这里的坐标是对象本身的坐标

iOS 系统弹窗点击猜测无力,还在研究中 ... ...

#2 楼 @vigossjjj AppleScript 只能在 模拟器了。

@vigossjjj Appium 支持 AppleScript 语言?貌似只支持 C#,OC,Java,Python,Ruby?

#4 楼 @eonianstar 可以调用外部的脚本。 appium 运行的就是 instruments 的 ui automation 就可以调用外部的脚本了。

#6 楼 @vigossjjj 加个头像呗。

需要 登录 后方可回复, 如果你还没有账号请点击这里 注册