初始化

This commit is contained in:
shikong 2024-08-01 18:52:16 +08:00
commit 447aaa5468
Signed by: Shikong
GPG Key ID: BD85FF18B373C341

33
main.py Normal file
View File

@ -0,0 +1,33 @@
import math
import time
import uiautomator2 as u2
import random
d = u2.connect("10.10.10.27:5555")
print(d.info)
print(d.device_info)
width, height = d.window_size()
print("width:{}, height:{}".format(width, height))
print(d.wlan_ip)
print(d.serial)
print(d.app_current())
d.app_start("com.ss.android.ugc.aweme", stop=False)
# d.xpath("关闭").wait(timeout=1)
random.seed(time.time())
for i in range(10):
startX = random.randint(0,int(width))
endX = round(startX + random.random(), 1)
endY = random.randint(0, int(height/10))
startY = round(endY * 9.75, 1)
# d.swipe_ext("up", scale=0.95, duration=0.1)
print(f"({startX}, {startY}) => ({endX}, {endY})")
d.swipe(startX, startY, endX + random.random(), endY, duration=0.05 + random.random() * 0.1)
time.sleep(5 + random.random() * 2)