Python3控制安卓手机快手极速版持续金币收益
一、電腦下載并安裝SDK Platform Tools
1.1、下載地址:https://developer.android.com/studio/releases/platform-tools.html
SDK Platform Tools官網頁面
選擇對應平臺的安裝文件
?
確認文件下載
1.2、下載后的文件:platform-tools_r30.0.4-windows.zip
1.3、解壓文件
?
解壓后的路徑與文件
1.4、為工具目錄添加系統環境變量
環境變量添加
1.5、驗證安裝結果
#執行命令
adb version
二、電腦安裝Python第三方包
2.1、安裝uiautomator2
pip install uiautomator2
2.2、手機與電腦通過USB連接后初始化
python -m uiautomator2 init
安裝完成,設備上會多一個ATX的應用
運行后的手機將安裝一個軟件
啟動
軟件啟動后可通過電腦控制手機
三、Weditor安裝與使用
3.1、安裝weditor
pip install weditor
3.2、運行weditor
python -m weditor
運行后瀏覽器會自動打開網頁weditor界面
http://localhost:17310/
輸入手機IP地址連接手機
用戶界面
3.3、編寫代碼向上滑動手機屏幕實現刷視頻
# coding: utf-8#import uiautomator2 as u2import timeimport randomd = u2.connect('192.168.3.109')# 循環n = 0while True: # True永遠循環下去n = n + 1print('正在進行第{}次滑動屏幕'.format(n))d.swipe(0.5, 0.6, 0.5, 0.12) # 向上滑動屏幕# 生成一個隨機數用于視頻觀看視頻t = random.randint(2, 9) # 生成一個2,9秒的隨機數# 程序暫停一個隨機秒數后,循環下一次滑動視頻print('暫停{}秒后將進入下一次循環'.format(t))time.sleep(t)?
備注:如果連接不上可以使用ADB進行測試
?
?
adb tcpip 5555
adb connect 192.168.3.109
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
d.swipe(0.5, 0.6, 0.5, 0.12) # 向上滑動屏幕
3.4、使用隨機函數和時間暫停和循環模擬自動滑動手機界面
# coding: utf-8
#
import uiautomator2 as u2
import time
import random
d = u2.connect(‘192.168.3.85’)
# 循環
n=0
while True:#True永遠循環下去
n=n+1
print(‘正在進行第{}次滑動屏幕’.format(n))
d.swipe(0.5, 0.6, 0.5, 0.12) # 向上滑動屏幕
# 生成一個隨機數用于視頻觀看視頻
t=random.randint(2,9)#生成一個2,9秒的隨機數
# 程序暫停一個隨機秒數后,循環下一次滑動視頻
print(‘暫停{}秒后將進入下一次循環’.format(t))
time.sleep(t)
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
總結
以上是生活随笔為你收集整理的Python3控制安卓手机快手极速版持续金币收益的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 我的图标设计网站
- 下一篇: python项目方案书模板格式_项目策划