33 lines
833 B
Python
33 lines
833 B
Python
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)
|
|
|