iOS已完美运行
SiliconZou opened this issue · comments
raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPConnectionPool(host='localhost', port=8100): Max retries exceeded with url: /status (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x1053cf0f0>: Failed to establish a new connection: [Errno 61] Connection refused',))
这个有遇到过吗
大神 求一个 IOS 的简单教程 需要什么东西。 我是WIN 10系统。。。 需要什么软件 运行什么脚本呢? 感谢
@xiao-Warning
配置WDA的最后:有些国产的iPhone机器通过手机的IP和端口还不能访问,此时需要将手机的端口转发到Mac上。
$ brew install libimobiledevice
$ iproxy 8100 8100
这时如果访问 http://localhost:8100/status 能显示一堆JSON数据,就说明WDA运行成功
然后再试试,应该就可以了
👌 谢谢 我试试看
@overthehump iOS我也是按照楼主的步骤一步一步来的,我用的MacBook Pro,win10的话可以装Mac的虚拟机,不过比较麻烦
大神 我运行的时候 截的图有时候不太对 你有这种情况吗
@SiliconZou @xiao-Warning
我也遇到这个错误了,在浏览器里面访问 http://localhost:8100/status 能显示一堆JSON数据,但是就是报异常
@SIXSIXSIXX 我这边截图的时候会把Python的进程给杀掉,但是还可以再重新运行,没发现图不对
@GhostClock Traceback (most recent call last):
File "wechat_jump_iOS_py3.py", line 30, in
pull_screenshot()
File "wechat_jump_iOS_py3.py", line 19, in pull_screenshot
c.screenshot('1.png')
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/wda/init.py", line 295, in screenshot
value = self.http.get('screenshot').value
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/wda/init.py", line 101, in fetch
return self._fetch_no_alert(method, url, data)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/wda/init.py", line 107, in _fetch_no_alert
return httpdo(target_url, method, data)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/wda/init.py", line 83, in httpdo
raise WDAError(r.status, r.value)
wda.WDAError: WDAError(status=13, value=To screenshot a frame, it must have non-0 area.
(
0 CoreFoundation 0x00000001824c2dc8 + 148
1 libobjc.A.dylib 0x0000000181b27f80 objc_exception_throw + 56
2 CoreFoundation 0x00000001824c2c80 + 0
3 Foundation 0x0000000182e48154 + 112
4 XCTest 0x000000010008806c -[XCUIScreen _screenshotDataForQuality:rect:error:] + 192
5 XCTest 0x0000000100087f38 -[XCUIScreen screenshotDataForQuality:rect:error:] + 108
6 WebDriverAgentLib 0x0000000106b3f2dc -[XCUIDevice(FBHelpers) fb_screenshotWithError:] + 624
7 WebDriverAgentLib 0x0000000106b20dbc +[FBScreenshotCommands handleGetScreenshot:] + 132
8 WebDriverAgentLib 0x0000000106b2da10 -[FBRoute_TargetAction mountRequest:intoResponse:] + 208
9 WebDriverAgentLib 0x0000000106b2563c __37-[FBWebServer registerRouteHandlers:]_block_invoke + 496
10 RoutingHTTPServer 0x0000000106bde3cc -[RoutingHTTPServer handleRoute:withRequest:response:] + 144
11 RoutingHTTPServer 0x0000000106bdeb80 __72-[RoutingHTTPServer routeMethod:withPath:parameters:request:connection:]_block_invoke + 44
12 libdispatch.dylib 0x0000000181f0d47c + 16
13 libdispatch.dylib 0x0000000181f1cae8 + 644
14 libdispatch.dylib 0x0000000181f0d47c + 16
15 libdispatch.dylib 0x0000000181f12b84 _dispatch_main_queue_callback_4CF + 1844
16 CoreFoundation 0x0000000182478d50 + 12
17 CoreFoundation 0x0000000182476bb8 + 1628
18 CoreFoundation 0x00000001823a0c50 CFRunLoopRunSpecific + 384
19 Foundation 0x0000000182db0cfc + 308
20 WebDriverAgentLib 0x0000000106b24630 -[FBWebServer startServing] + 424
21 WebDriverAgentRunner 0x00000001006abbe4 -[UITestingUITests testRunner] + 132
22 CoreFoundation 0x00000001824c8a60 + 144
23 CoreFoundation 0x00000001823c0488 + 284
24 XCTest 0x0000000100072654 __24-[XCTestCase invokeTest]_block_invoke.275 + 48
25 XCTest 0x0000000100072404 __24-[XCTestCase invokeTest]_block_invoke + 680
26 XCTest 0x00000001000b89d8 -[XCUITestContext performInScope:] + 208
27 XCTest 0x000000010007214c -[XCTestCase invokeTest] + 136
28 XCTest 0x0000000100073224 __26-[XCTestCase performTest:]_block_invoke.382 + 48
29 XCTest 0x00000001000bda78 +[XCTContext runInContextForTestCase:block:] + 164
30 XCTest 0x0000000100072c20 -[XCTestCase performTest:] + 596
31 XCTest 0x000000010006ee14 __27-[XCTestSuite performTest:]_block_invoke + 288
32 XCTest 0x000000010006e83c -[XCTestSuite _performProtectedSectionForTest:testSection:] + 44
我访问localhost之后一执行python3 wechat_jump_iOS_py3.py就这样了
@xiao-Warning 我访问localhost是错误没数据的,然后iproxy 8100 8100后 再打开http://localhost:8100/inspector就可以了
楼主,IOS可以自动跳吗?
iphone 6s
time_coefficient = 0.00190
不会用GitHub发这里了
卡在iproxy这一项了,
$iproxy 8100 8100
waiting for connection
accepted connection, fd = 4
waiting for connection
Number of available devices == 1
Requesting connecion to device handle == 40 (serial: 81d9164fb0991126168fc7b35d493205ae067ffb), port 8100
Error connecting to device!
启动之后
$ python3 wechat_jump_iOS_py3.py
retry to connect, error: HTTPConnectionPool(host='localhost', port=8100): Read timed out. (read timeout=60.0)
提示错误
@LucasDvP 好像是不能,我是一步一步点着跳的😂 iPhone6的参数time_coefficient = 0.00200
@w0wbin 我刚开始也是一直waiting for connection,然后就打开http://localhost:8100/inspector这个网址,同时也要打开小游戏的界面,多刷新了几次等手机界面上的内容显示到网址后再次运行 wechat_jump_iOS_py3.py就可以了
iPhone 7 Plus 系数
time_coefficient = 0.00120
@xiao-Warning 我遇到的问题和你一模一样 请问你解决了吗
@SiliconZou requests.exceptions.ConnectionError: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response',)) 这是是什么情况
成功实现了。不过不能自动跳,哪个大神尽快出自动跳版本吧
我也可以实现了,但是需要手动点击一下,每次不能跳到中心点,有误差,有时候也会跳不上去。这个应该怎么处理啊
Android的auto脚本稍稍改下就可以在ios上自动跳了,不过参数一直不够完美,只能跳到几百,就不发出来了,等dalao撸个完美的。
@SwiftieTerrence 求IOS自动跳的脚本
@Qiuliuyang 如何点击让他一步步跳,图片显示的分数是我在手机上点击的跳
@zhangmyWZDY 在matplot里面上点一下起始坐标,再点一下终点坐标就行了。会自动跳
@Qiuliuyang thks , 有没有出现python界面显示不全,点完一个块,下一个块不在屏幕中显示,或者找不到下一个块的坐标点,请问如何解决?
@zhangmyWZDY 是你手机连接不太好?我还没有这个问题,延迟倒是有,不过等一两秒就好了
@SiliconZou 楼主 怎么让他自动跳?wda应该在9.3.2d的系统运行有问题
@SiliconZou 手动。。说错
@cultivater 你指哪一个?
@xiao-Warning 你遇到的那几个问题我都遇到过,尤其是最后的http://localhost:8100/inspector不显示手机的界面,你最后怎么解决的呢?
iPhone 7 plus跳一步之后界面刷新不完整,有大佬遇到过么,求解决方法。
iphone 怎么保证每次都跳到中心点?
@LucasDvP 我在想能不能把代码改改,点击第一次获取起点的中心点,点击第二次获取终点的中心点,distance就等于两个中心点的间距,这样无论怎么点,就都是跳到中心点了(保证每次都点到几何体的情况下)
在Mac下运行,好像需要把
ani = animation.FuncAnimation(fig, updatefig, interval=50, blit=True)
改为
ani = animation.FuncAnimation(fig, updatefig, interval=50, blit=False)
要不然,不会自动更新图像
@LucasDvP 环境都没有问题,同样的环境下,6s和7p都可以成功test,唯独5s不行,我正在升级5s的系统,想知道是不是系统的问题,因为我用模拟器验证过是正常的。
可以自动化了。见:
https://github.com/wangshub/wechat_jump_game/pull/273/files
运行前提:
一个iOS设备、一台Mac电脑、一份Xcode
- 安装brew
- 安装WebDriverAgent,各种问题可以参考这个帖子
- 安装python3,即
brew install python3
- 安装本项目的各种依赖
pip3 install -r requirements.txt
- 安装WebDriverAgent的Python库:
pip3 install facebook-wda
- 安装
brew install libimobiledevice
接下来
- 手机用线连接mac,然后xcode通过真机运行WebDriverAgent(Product->test)
- 电脑运行
iproxy 8100 8100
,在电脑浏览器访问http://localhost:8100/status
看是否有输出。有则说明wda正常。 - 手机运行跳一跳程序
- 电脑运行
python3 wechat_jump_auto_iOS.py
即可。
不断调整代码里的参数,使得可以自动完成。
@kaizhetutuquliaomei 不排除是wda和iOS9的兼容问题啊。
不过我想也没必要为了这个就升级系统吧。
@kaizhetutuquliaomei 我刚刚用5s@iOS10试了一下,第一次也是截图崩。后来关了一些程序,重新就好了。估计是内存不足..(5s和6都是内存捉急)
@kaizhetutuquliaomei 我只能说inspector有时正常,有时不正常。
xcode里面经常报错ebDriverAgentRunner-Runner[249:8414] Enqueue Failure: Application local.pid.195 is not running
iPhoneSE的参数
time_coefficient = 0.00225
请问配置WDA bundle签名证书那些一定需要个人证书吗
mac + iPhoneX完美运行
@Azleal 请教下,iPhone X 的参数如何配置
@goodbest
你好,在运行wda的时候 弹出什么要access的钥匙串密钥,我不知道,然后我就点了拒绝,现在就跑不起来了。提示这个错误
CodeSign /Users/pengpn/Library/Developer/Xcode/DerivedData/WebDriverAgent-epqieiskmzjtbzfnpjbdjrvtlmrx/Build/Products/Debug-iphoneos/WebDriverAgentRunner-Runner.app/Frameworks/XCTAutomationSupport.framework
cd /Users/pengpn/Downloads/WebDriverAgent
export CODESIGN_ALLOCATE=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/codesign_allocate
export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
Signing Identity: "iPhone Developer: 312924860@qq.com (5B98PT69ZW)"
/usr/bin/codesign --force --sign 2C4AD029F196C7ECFC5FC0E94A9EDD5BA80C1DBA --deep --preserve-metadata=identifier,entitlements,flags --timestamp=none /Users/pengpn/Library/Developer/Xcode/DerivedData/WebDriverAgent-epqieiskmzjtbzfnpjbdjrvtlmrx/Build/Products/Debug-iphoneos/WebDriverAgentRunner-Runner.app/Frameworks/XCTAutomationSupport.framework
/Users/pengpn/Library/Developer/Xcode/DerivedData/WebDriverAgent-epqieiskmzjtbzfnpjbdjrvtlmrx/Build/Products/Debug-iphoneos/WebDriverAgentRunner-Runner.app/Frameworks/XCTAutomationSupport.framework: replacing existing signature
/Users/pengpn/Library/Developer/Xcode/DerivedData/WebDriverAgent-epqieiskmzjtbzfnpjbdjrvtlmrx/Build/Products/Debug-iphoneos/WebDriverAgentRunner-Runner.app/Frameworks/XCTAutomationSupport.framework: unknown error -1=ffffffffffffffff
Command /usr/bin/codesign failed with exit code 1
@SiliconZou 按照你说的方式安装了iproxy,问题依然存在。
ip:port/status 无数据
localhost:port/status 有数据
但是
localhost:port/inspector访问非常缓慢
而且执行py的时候提示
requests.exceptions.ConnectionError: HTTPConnectionPool
最大重试次数过多的问题
折腾小半天终于OK了,刷了3288分
npm版本要更新最新
iphone端口不能直接http访问,brew install libimobiledevice,不是brew install imobiledevice
iphone7plus: time_coefficient = 0.00117
@BABALA258 请问下WDA general那块签名怎么弄,用什么签名证书。。感谢
卡在 waiting for connection。捂脸
@Abysman 我用的是apple开发者账号,到developer.apple.com去新建iOS Provisioning Profiles下载到xcode使用;
@BABALA258 感谢。。不过这是不是收费的才能有证书
@BABALA258 不能直接http访问怎么办呢 我一直在waiting for connection
@LucisBaoshg 参考一下 issues/4 , 另外wechat_jump_iOS_py3.py 中的参数已经是iPhone X的推荐参数了, 我没有调.
@zhangmyWZDY 你把 wechat_jump_iOS_py3.py 里面的 time.sleep(1) 改成合适的时间 我试了 1.5s 没问题
有没有人和我一样中途把手机拔了的。。然后估计是iproxy映射的问题,就再也连不上了。。。
自己解决了。。用lsof -i tcp:port 将port换成被占用的端口(如:8100),然后找到进程的PID,使用kill命令:kill PID(进程的PID,如40989),杀死对应的进程。再重新用iproxy映射就可以了
一定要有mac电脑吗?
iphone8 plus
time_coefficient = 0.00120
6s
用auto的跑起来了,可以加上总分识别来完成指定总分的功能
iPhone 6 + Mac
自动模式下 press_coefficient = 1.95 个人觉得比较合适
另外,time.sleep(random.uniform(2, 3)) 设置为2-3 这样更稳定同时还能够获得 唱片机 便利店等的加分
再次感谢作者们!
@Abysman 不用的,改了WebDriverAgent的BundleID,用自己icloud账号就行,参考给出的https://testerhome.com/topics/7220这篇的“免费版的个人证书“这段
@SiliconZou @goodbestpip3 install –pre facebook-wda
Invalid requirement: '–pre'
Traceback (most recent call last):
File "/usr/local/lib/python3.6/site-packages/pip/_vendor/packaging/requirements.py", line 92, in init
req = REQUIREMENT.parseString(requirement_string)
File "/usr/local/lib/python3.6/site-packages/pip/_vendor/pyparsing.py", line 1617, in parseString
raise exc
File "/usr/local/lib/python3.6/site-packages/pip/_vendor/pyparsing.py", line 1607, in parseString
loc, tokens = self._parse( instring, 0 )
File "/usr/local/lib/python3.6/site-packages/pip/_vendor/pyparsing.py", line 1379, in _parseNoCache
loc,tokens = self.parseImpl( instring, preloc, doActions )
File "/usr/local/lib/python3.6/site-packages/pip/_vendor/pyparsing.py", line 3376, in parseImpl
loc, exprtokens = e._parse( instring, loc, doActions )
File "/usr/local/lib/python3.6/site-packages/pip/_vendor/pyparsing.py", line 1379, in _parseNoCache
loc,tokens = self.parseImpl( instring, preloc, doActions )
File "/usr/local/lib/python3.6/site-packages/pip/_vendor/pyparsing.py", line 3698, in parseImpl
return self.expr._parse( instring, loc, doActions, callPreParse=False )
File "/usr/local/lib/python3.6/site-packages/pip/_vendor/pyparsing.py", line 1379, in _parseNoCache
loc,tokens = self.parseImpl( instring, preloc, doActions )
File "/usr/local/lib/python3.6/site-packages/pip/_vendor/pyparsing.py", line 3359, in parseImpl
loc, resultlist = self.exprs[0]._parse( instring, loc, doActions, callPreParse=False )
File "/usr/local/lib/python3.6/site-packages/pip/_vendor/pyparsing.py", line 1383, in _parseNoCache
loc,tokens = self.parseImpl( instring, preloc, doActions )
File "/usr/local/lib/python3.6/site-packages/pip/_vendor/pyparsing.py", line 2670, in parseImpl
raise ParseException(instring, loc, self.errmsg, self)
pip._vendor.pyparsing.ParseException: Expected W:(abcd...) (at char 0), (line:1, col:1)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.6/site-packages/pip/req/req_install.py", line 82, in init
req = Requirement(req)
File "/usr/local/lib/python3.6/site-packages/pip/_vendor/packaging/requirements.py", line 96, in init
requirement_string[e.loc:e.loc + 8]))
pip._vendor.packaging.requirements.InvalidRequirement: Invalid requirement, parse error at "'–pre'"
大佬 help!
iPhone 7 + mac
建议将 wechat_jump_auto_iOS.py
中的
if abs(pixel[0] - last_pixel[0]) + abs(pixel[1] - last_pixel[1]) + abs(pixel[2] - last_pixel[2]) > 10
改为
if abs(pixel[0] - last_pixel[0]) + abs(pixel[1] - last_pixel[1]) + abs(pixel[2] - last_pixel[2]) > 2
对于一些圆形带条纹board效果好,完成了500到1000以上的质变
此外
time.sleep(random.uniform(1, 1.1)) # 为了保证截图的时候应落稳了,多延迟一会儿
改成
time.sleep(random.uniform(1.4, 1.5)) # 为了保证截图的时候应落稳了,多延迟一会儿
这样可以吃到大多数的5/10/15/20。上面提到的2,3也是稳妥的选择。
感谢作者和大家,祝不删好友
卡在waiting for connection,尝试了很多办法都没解决,有人遇到这个问题的嘛