美文网首页
Python-iOS微信跳一跳

Python-iOS微信跳一跳

作者: 笑破天 | 来源:发表于2020-12-20 01:14 被阅读0次

微信跳一跳 mac + iphone 图文教程

一 、安装WDA https://testerhome.com/topics/7220
原wda不维护了,用appium的fork(直接去git download比较快)
1.1 github上下载代码

git clone https://github.com/appium/WebDriverAgent

1.2 安装 carthage http://blog.csdn.net/Mazy_ma/article/details/70185547

brew install carthage
carthage version

1.3 运行初始化脚本

cd  xx/xx/WebDriverAgent
./Scripts/bootstrap.sh

1.4 启动 WDA https://testerhome.com/topics/7220
双击打开WebDriverAgent.xcodeproj这个文件
WebDriverAgentLib和WebDriverAgentRunner配置证书,选择scheme和设备
最后运行 Product -> Test
成功:控制台会打印一个IP地址,这时通过访问http://localhost:8100/status确认WDA是否运行成功。

1.5 如果http://localhost:8100/status没反应,需要安装端口转发工具 。命令为

brew install libimobiledevice

下载太慢,连手机热点。或者换国内源
git -C "$(brew --repo)" remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git

A CA file has been bootstrapped using certificates from the system
keychain. To add additional certificates, place .pem files in
  /usr/local/etc/openssl@1.1/certs

and run
  /usr/local/opt/openssl@1.1/bin/c_rehash

openssl@1.1 is keg-only, which means it was not symlinked into /usr/local,
because macOS provides LibreSSL.

If you need to have openssl@1.1 first in your PATH run:
  echo 'export PATH="/usr/local/opt/openssl@1.1/bin:$PATH"' >> ~/.zshrc

For compilers to find openssl@1.1 you may need to set:
  export LDFLAGS="-L/usr/local/opt/openssl@1.1/lib"
  export CPPFLAGS="-I/usr/local/opt/openssl@1.1/include"

For pkg-config to find openssl@1.1 you may need to set:
  export PKG_CONFIG_PATH="/usr/local/opt/openssl@1.1/lib/pkgconfig"
Warning: Building python@3.9 from source:
  The bottle needs the Apple Command Line Tools to be installed.
  You can install them, if desired, with:
    xcode-select --install

1.6需要安装端口转发之后,转发端口。 iproxy 8100 8100
端口转发之后,就可以看到http://localhost:8100/status的json数据
而inspector的地址是http://localhost:8100/inspector, inspector是用来查看UI的图层,方便写测试脚本用的

二、去github下载脚本 https://github.com/wangshub/wechat_jump_game

pip3 install --pre facebook-wda

pip3 install -r requirements.txt

拷贝 ./config/iPhone 目录下对应的设备配置文件,重命名并替换到 ./config.json

执行脚本文件 python3 wechat_jump_auto_iOS.py

报错了
解决:tap_hold方法-_percent2pos方法的值问题,float默认是百分比,int默认是绝对坐标,手动更改一下代码即可。

s.tap_hold(int(random.uniform(0, 320)), int(random.uniform(64, 320)), press_time)
    def tap_hold(self, x, y, duration=1.0):
        """
        Tap and hold for a moment

        Args:
            - x, y(int, float): float(percent) or int(absolute coordicate)
            - duration(float): seconds of hold time

三、后续使用

1、运行初始化脚本

cd  xx/xx/WebDriverAgent
./Scripts/bootstrap.sh

2、转发端口。 iproxy 8100 8100
3、启动 WDA https://testerhome.com/topics/7220
双击打开WebDriverAgent.xcodeproj这个文件
WebDriverAgentLib和WebDriverAgentRunner配置证书,选择scheme(注意选WebDriverAgentRunner)和设备
最后运行 Product -> Test
成功:控制台会打印一个IP地址,这时通过访问http://localhost:8100/status确认WDA是否运行成功。
4、执行脚本文件 python3 wechat_jump_auto_iOS.py

注意:WebDriverAgentRunner的证书设置id在build setting里面

iOS 真机如何安装 WebDriverAgent
UI 自动化框架 (基于 facebook-wda)

四、一些遇到的问题

1、code ERESOLVE
ERESOLVE unable to resolve dependency tree
npm 版本太高,需要降低版本
npm install npm@6.14.7 -g
npm view npm versions
或上github查看tags版本

2、Building for iOS, but the linked and embedded framework 'RoutingHTTPServer.framework' was built for iOS + iOS Simulator.
把runner配置好即可,cmd+u的schme选择runner

3、Error starting Appium server: listen EADDRNOTAVAIL: address not available 192.168.104.118:8100
用127.0.0.1/status

4、python依赖库
pip3 install matplotlib
pip3 install opencv-python

相关文章

  • Python-iOS微信跳一跳

    微信跳一跳 mac + iphone 图文教程[https://www.jianshu.com/p/ff973a5...

  • 小程序大变化

    说到微信小程序,大家可能首先会想到“跳一跳”,的确,跳一跳的火爆,一下打开了微信小程序对外的窗口。当然,跳一跳只是...

  • 微信小游戏「跳一跳」高分秘籍,轻轻松松排第一

    微信更新的 6.6.1 版本,启动页面重点推荐了小游戏「跳一跳」。 玩法说明 在微信小游戏「跳一跳」游戏中,你需要...

  • 原来微信《跳一跳》也可以用Python玩~

    微信更新的 6.6.1 版本突然也开放了小游戏,微信启动页面还重点推荐了小游戏「跳一跳」。 跳一跳 玩家需要「按住...

  • 微信跳一跳

    代码 init(0, 0) local screenWidth, screenHeight= getScreenS...

  • 微信跳一跳

    微信跳一跳这个游戏刚出来时候火遍了朋友圈,现在热度还一直不减,前两天GF让我帮她刷分,找了个脚本用起来感觉不错,在...

  • 微信跳一跳

    1、 人就像弹簧,被压的越低,跳的越远 2、 人生没有回头路,每一步都要深思熟虑 3、 步子太大容易扯到蛋;胆子太...

  • 微信跳一跳

    最近微信跳一跳可谓非常的火,各种辅助外挂也是层出不穷,但是绝大多数辅助都是需要安卓设备root后才能使用的,有没有...

  • 微信跳一跳

    起因 微信刚刚更新了一个版本,主推了一个叫跳一跳的小程序。蹲坑完了2小时,完了300多点,站都站不起来。。。 上网...

  • 跳一跳小游戏贴膜使用说明

    还有相关详细文章见以下: 微信跳一跳深度解密(上篇)——隐藏在游戏里的移动轨迹 微信跳一跳深度解密(下篇实战篇):...

网友评论

      本文标题:Python-iOS微信跳一跳

      本文链接:https://www.haomeiwen.com/subject/uilhnktx.html