Tools to prepare

  1. Python3.7.7
  2. Adb (Android Debug Bridge)
  3. uiautomatorviewer

Install the adb

Website address: developer. The android. Google. Cn/studio/comm…

Download it and decompress it to set the environment variables

Install uiautomatorviewer

A debugging tool

  1. The phone connects to the PC via USB to enable developer options and USB debugging

  2. Through the computeradb devices -lCommand to view connected devices

  3. Open UIAutomatorViewer and connect to your phone

Python installation uiautomator2

pip install --pre -U uiautomator2
1
Copy the code
  • Install atX-Agent on the device

    python -m uiautomator2 init

Note that the device is turned on to allow the installation of UIAutomator.apk

支那

支那

Write main program

  • Locate tiktok position

The following are the locating methods: text: a(text= “resourceId”).click() resourceid: A (resourceId = “com. Smartisanos. Clock: id/text_stopwatch”). Click the classname () : A (className = “android. The widget. The TextView”). Click () description: a (description = “…” ).click()

import uiautomator2 as d import time def douyin(): A = dconnect_USB (' 3d51a18C ').click() while True Time. Sleep (10) slide # video a.s wiper (313137 0313110) if __name__ = = "__main__ ': douyin ()Copy the code

Just hit Run

Recently, many friends have sent messages to ask about learning Python. For easy communication, click on blue to join yourselfDiscussion solution resource base