51Testing软件测试论坛

标题: monkeyrunner中触摸屏幕老出错,都无奈了。device.touch应该怎么用呀 [打印本页]

作者: 2339073008    时间: 2017-9-27 14:28
标题: monkeyrunner中触摸屏幕老出错,都无奈了。device.touch应该怎么用呀
本帖最后由 2339073008 于 2017-10-9 10:05 编辑

from com.android.monkeyrunner import MonkeyRunner, MonkeyDevice, MonkeyImage
device=MonkeyRunner.waitForConnection(5,'559a4ec5')
result = device.takeSnapshot()
result.writeToFile('D:\monkeyrunner\test1\Test1_001.png','png')
print ('Success!')
device.installPackage('D:\monkeyrunner\JiaoTongJDTralvel.apk')
print ('Install Success!')
MonkeyRunner.sleep(5)
device.startActivity(component = "com.jiaotong.app/.mvp.module.launch.SplashScreenActivity")
result = device.takeSnapshot()
result.writeToFile('D:\monkeyrunner\test1\Test1_002.png','png')
print ('Success!')
MonkeyRunner.sleep(5)
device.drag((180,180),(600,600),0.1,10)





>>> device.touch(250,450,'Down_And_Up')
170927 11:12:14.112:S [main] [com.android.chimpchat.adb.AdbChimpDevice] Error se
nding touch event: 250 450 DOWN_AND_UP
170927 11:12:14.112:S [main] [com.android.chimpchat.adb.AdbChimpDevice]java.net.
SocketException: Software caused connection abort: socket write error
170927 11:12:14.112:S [main] [com.android.chimpchat.adb.AdbChimpDevice] at java.
net.SocketOutputStream.socketWrite0(Native Method)
170927 11:12:14.112:S [main] [com.android.chimpchat.adb.AdbChimpDevice] at java.
net.SocketOutputStream.socketWrite(SocketOutputStream.java:111)


>>> device.touch(250,450,'DOWN_AND_UP')
170927 11:13:46.857:S [main] [com.android.chimpchat.adb.AdbChimpDevice] Error se
nding touch event: 250 450 DOWN_AND_UP
170927 11:13:46.857:S [main] [com.android.chimpchat.adb.AdbChimpDevice]java.net.
SocketException: Software caused connection abort: socket write error
170927 11:13:46.857:S [main] [com.android.chimpchat.adb.AdbChimpDevice] at java.
net.SocketOutputStream.socketWrite0(Native Method)
170927 11:13:46.857:S [main] [com.android.chimpchat.adb.AdbChimpDevice] at java.
net.SocketOutputStream.socketWrite(SocketOutputStream.java:111)

>>> device.touch(250,450,"DOWN_AND_UP")
170927 11:26:48.736:S [main] [com.android.chimpchat.adb.AdbChimpDevice] Error se
nding touch event: 250 450 DOWN_AND_UP
170927 11:26:48.736:S [main] [com.android.chimpchat.adb.AdbChimpDevice]java.net.
SocketException: Software caused connection abort: socket write error
170927 11:26:48.736:S [main] [com.android.chimpchat.adb.AdbChimpDevice] at java.
net.SocketOutputStream.socketWrite0(Native Method)
170927 11:26:48.736:S [main] [com.android.chimpchat.adb.AdbChimpDevice] at java.
net.SocketOutputStream.socketWrite(SocketOutputStream.java:111)



作者: 海海豚    时间: 2017-9-27 16:04
https://testerhome.com/topics/1466   你看这个链接,评论里面有个人和你是同样的问题解决方法是这个“发现启动时是‘com.xx.xxx/.xxxActivity’,没有前面的.activity。去掉这个后就可以启动了”  可以试一下
作者: jingzizx    时间: 2017-9-28 08:05

作者: 2339073008    时间: 2017-10-9 09:15
海海豚 发表于 2017-9-27 16:04
https://testerhome.com/topics/1466   你看这个链接,评论里面有个人和你是同样的问题解决方法是这个“发 ...

好的,多谢。我看看去
作者: 2339073008    时间: 2017-10-16 09:42
还没找到解决办法




欢迎光临 51Testing软件测试论坛 (http://bbs.51testing.com/) Powered by Discuz! X3.2