开篇前说一下上周和这周都没更新算法题。因为这两周的算法题难度级别都是'Hard',经典题N皇后问题,网上太多太多了,各种语言都有,有兴趣的小伙伴上网自己搜就好了。
今天也是2017的最后一天,前几天微信出了小游戏"跳一跳",一下就火遍了朋友圈,作为一个程序员,装逼的时刻就来临了。。。
使用工具:GitHub上的wechat_jump_game,再此也感谢作者:神奇的战士-王松
我这里只介绍我在iPhone上的实现过程,安卓的朋友们就自己研究下吧:
安装WebDriverAgentRunner
点击进入下载页,下载后用终端进入该目录下,执行 ./Scripts/bootstrap.sh
,然后提示报错,原因是我没安装Carthage
,那么就先来安装Carthage
吧,执行命令brew install carthage
,需要注意的是,这里Carthage
已经不支持以管理员身份安装了,即sudo
。安装完成后再执行./Scripts/bootstrap.sh
,又报错了,说我没安装npm
,好吧,再去安装npm
,打开网站,下载需要的版本并安装,安装完成后再次执行./Scripts/bootstrap.sh
,OK,终于完成了。。。
安装facebook-wda
因为我用的是Python3,所以执行pip3 install --pre facebook-wda
,如果用Python2的执行pip install --pre facebook-wda
配置使用WebDriverAgentRunner
打开项目WebDriverAgent.xcodeproj
,配置所有target的证书(有的网站上说只要配置前两个target就可以,但我的报错不能运行,需要配置所有的target,有的朋友问怎么配置,就是让Xcode自动管理证书就好,因为免费的账号无法进去开发者个人中心去配置的),修改WebDriverAgentRunner
和IntegrationApp
的bundleID,依次设置Product-Scheme为WebDriverAgentRunner
,Product-Destination为你的手机,执行Product-Test,运行成功会显示IP。后面发现通讯拒绝,需要依次执行brew install usbmuxd
,brew install imobiledevice

安装Python依赖库
在终端进入wechat_jump_game目录,执行pip3 install -r requirements.txt
开始装逼。。。
1.执行Product-Test,运行WebDriverAgentRunner
,在终端中执行iproxy 8100 8100
。
2.微信进入跳一跳开始界面
3.用PyCharm打开wechat_jump_game
,运行python3 wechat_jump_iOS_py3.py
文件,会展示跳一跳界面(之前Python的环境都装好了,如果没有就看前面关于安装Python环境的文章),点击开始位置,然后点击目的位置不放开,小游戏中的人物就会自动跳一下,Pycharm中会显示数字
4.参照Pycharm中的数字调整time_coefficient
,调整好后循环2、3步骤即可。
最后想装成什么程度就看自己的了,元旦快乐。。。
网友评论
“这是为什么啊”
2018-01-04 18:49:51.304022+0800 WebDriverAgentRunner-Runner[534:24295] Running tests...
2018-01-04 18:49:51.321632+0800 WebDriverAgentRunner-Runner[534:24295] 未能载入软件包“WebDriverAgentRunner”,因为未能找到其可执行文件的位置。 请尝试重新安装软件包。
@大佬求助解决办法
npm WARN deprecated minimatch@2.0.10: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated css-list@0.1.3: Deprecated.
楼主, 提示这个已经被废弃,请问如何解决啊?
修改成啥?
retry to connect, error: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response',))
Traceback (most recent call last):
File "/usr/local/lib/python3.6/site-packages/urllib3/connectionpool.py", line 601, in urlopen
chunked=chunked)
File "/usr/local/lib/python3.6/site-packages/urllib3/connectionpool.py", line 387, in _make_request
six.raise_from(e, None)
File "<string>", line 2, in raise_from
File "/usr/local/lib/python3.6/site-packages/urllib3/connectionpool.py", line 383, in _make_request
httplib_response = conn.getresponse()
File "/usr/local/lib/python3.6/site-packages/requests/adapters.py", line 490, in send
raise ConnectionError(err, request=request)
requests.exceptions.ConnectionError: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response',))
= = 就差这一步了 = =
waiting for connection
accepted connection, fd = 4
waiting for connection
Number of available devices == 3
Requesting connecion to device handle == 247 (serial: 0b946f8bcc0daa316f0643688ca419b3a77bfeeb), port 8100
Error connecting to device!
accepted connection, fd = 4
waiting for connection
Number of available devices == 3
Requesting connecion to device handle == 247 (serial: 0b946f8bcc0daa316f0643688ca419b3a77bfeeb), port 8100
Error connecting to device!
为啥啊 ,大佬