We must have played this game, in the second floor of wechat home page (drop-down) position launched a “jump jump” small program, instantly flooded the circle of friends.

When everyone is busy with the game, someone invented a unique way based on Python + WebDriverAgent to achieve a PC remote control of the mobile phone “jump” small program to automatically jump, brush the score to the outrageous point, quietly occupy the first place in the circle of friends.

​​

There have been several popular articles detailing how to do this, but more or less the description is not detailed enough, and the parameter Settings only work well on some models. This also caused me to tread a few holes in the implementation process following these tutorials. This article is based on the Macbook + iPhone 6s Plus to explain how to achieve the above process, and will also step on the pit record.

Environment to prepare

Install python3

~ python3 -v Python 3.6.4 Copies the codeCopy the code

Create the PYTHon3 virtual environment

Address: document docs.python.org/3/tutorial/… The method is as follows:

~ python3 -m venv tutorial-env ~ source tutorial-env/bin/activate (tutorial-env) ➜ ~ copy codeCopy the code

Install the PIP

Install the Python package management tool PIP. IO /en/latest/ I… The method is as follows:

(tutorial - env) ➜ ~ curl https://bootstrap.pypa.io/get-pip.py - o get - PIP. Py (tutorial - env) ➜ ~ python get - PIP. Py duplicate codeCopy the code

Install xcode

Install via appstore

Install WebDriverAgent

Xcode, as new as possible. Update Xcode to the latest version as much as possible and keep the iPhone version older than 9.3.

Download the code from Github

Git clone https://github.com/facebook/WebDriverAgent duplicate codeCopy the code

Installation of Carthage

Brew install Carthage Copies the codeCopy the code

Run the initialization script

/Scripts/bootstrap.sh Copies the codeCopy the code

The script downloads all dependencies using Carthage and packages the response JS files using NPM

After the execution is complete, double-click the webDriverAgent. xcodeProj file.

Set up the certificate

To set the certificate signature, check the personal account in the Team column.

Then select WebDriverAgentRunner in TARGETS and set the certificate in the same way

Rename the WebDriverAgent BundleID to avoid the same name.

Then select WebDriverAgentRunner in TARGETS and rename it in the same way.

Run and test

Select WebDriverAgentRunner in xcode-product-scheme.

Connect the iPhone to the macbook with a cable. In xcode-product-destination, select the iPhone to which the data cable connects.

Run xcode-product-test

Port forwarding

~ brew install libiMobileDevice ~ iProxy 8100 8100 Copy codeCopy the code

Use iProxy –help to find more specific usage. At this time by visiting http://localhost:8100/status to confirm whether WDA run successfully. The inspector’s address is shimo.im/docs/CHrj8w… Inspector is used to view the layers of the UI for writing test scripts

​​

Use Python to control the iPhone to automatically jump

Get the Python hop code

Git clone [email protected]: korbinzhao/wechat_jump_game. Git duplicate codeCopy the code

Install the facebook – wda

(tutorial-env) ➜ ~ pip3 install --pre facebook-wda copy codeCopy the code

Installation project dependencies

(tutorial-env) ➜ wechat_jump_game git:(master) qualify pip3 install-r requirementsCopy the code

Copy the device configuration file in./config/iPhone, rename it, and replace it with./config.json

Open the mini program interface on the phone and run the Python script

(tutorial-env) ➜ wechat_jump_game git:(master) university python3 wechat_jump_auto_iOSCopy the code

The final result

I was wondering who else could be so boring, and I thought 1,000 points would definitely be number one!

⑥ Project source code cases to share

If you use it, you can take it away directly, in my QQ technical exchange group group number: 948351247 (pure technical exchange and resource sharing, advertising is not allowed) to take it away by yourself

Click here to collect