你先看看你的代码,都是 Start
错误信息是?
查查 Java 环境变量配置的是否正确
至于模拟器的地址,GUI 中如何设置不清楚(找了一圈没找到),在 Command Line 下可以使用 --app 参数来指定
最新的版本也不支持 iOS8,等 1.3 吧
没有 cleartext 成功?
知乎是个好去处
又是不看日志
传个头像,亲
不写环境,不写版本,不写平台,不看日志,不看提示,这种问题无法回答
#4 楼 @wangcityboy 解锁是有问题,apple 的 bug
不错,学习了
#8 楼 @seveniruby 恩。这样更好
#16 楼 @seasoncool2011
真心不错,我现在也可以跑起来,以后做演示就方便啊
豌豆荚,应用宝等手机管理工具的无线连接,也应该和这是一个道理吧
#5 楼 @wangcityboy 你这样问,神仙也没办法帮你,需要将你的代码信息和报错信息才能帮你看啊
#3 楼 @seveniruby 哦,看岔了
经过实践,发现不可行
不管 duration 传多少,在 UIAutomation 中 time 总是 0.2,依然是普通 Tap 的效果
Code:
self.driver.tap([(176, 86)], duration=5000)
附 Log:
info: --> POST /wd/hub/session/75108063-b03d-42f1-9922-0b31b641cf3e/touch/perform {"sessionId":"75108063-b03d-42f1-9922-0b31b641cf3e","actions":[{"action":"longPress","options":{"y":86,"x":176}},{"action":"release","options":{}}]}
debug: Appium request initiated at /wd/hub/session/75108063-b03d-42f1-9922-0b31b641cf3e/touch/perform
debug: Request received with params: {"sessionId":"75108063-b03d-42f1-9922-0b31b641cf3e","actions":[{"action":"longPress","options":{"y":86,"x":176}},{"action":"release","options":{}}]}
debug: Pushing command to appium work queue: "target.touch([{\"touch\":[{\"x\":176,\"y\":86}],\"time\":0.2}])"
debug: Sending command to instruments: target.touch([{"touch":[{"x":176,"y":86}],"time":0.2}])
debug: Sending command to instruments: target.touch([{"touch":[{"x":176,"y":86}],"time":0.2}])
debug: [INST] 2014-08-30 02:51:33 +0000 Debug: evaluation finished
debug: [INST] 2014-08-30 02:51:33 +0000 Debug: Running system command #12: /Applications/Appium.app/Contents/Resources/node/bin/node /Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/appium-uiauto/bin/command-proxy-client.js /tmp/instruments_sock 2,{"status":0,"value":null}...
debug: [INST] 2014-08-30 02:51:38 +0000 Debug: Got new command 12 from instruments: target.touch([{"touch":[{"x":176,"y":86}],"time":0.2}])
debug: [INST] 2014-08-30 02:51:38 +0000 Debug: evaluating target.touch([{"touch":[{"x":176,"y":86}],"time":0.2}])
debug: [INST] 2014-08-30 02:51:38 +0000 Debug: target.touch(__NSCFArray)
用 UIAutomation 自己的 tapWithOptions({tapOffset:{x:2.02, y:3.41}, duration:10});就可以
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:
duration = duration
action.long_press(x=x, y=y, duration=duration).release()
else:
action.tap(x=x, y=y).release()
action.perform()
else:
ma = MultiAction(self)
for position in positions:
x = position[0]
y = position[1]
action = TouchAction(self)
if duration:
duration *= 1000 # we take seconds, but send milliseconds
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
iOS 测试和游戏测试只有 Testin 有啊
#3 楼 @wangcityboy 如何连接真机?
三部分,第一,需要将手机和 Mac 连接起来,第二,将被测应用(需要 development 证书)安装到真机上 第三,在 Appium 上配置真机的 UDID 以及被测应用的 BundleID
是啊,Appium 会把包装到你的真机上
锁屏用 lock 方法