From 447aaa54684468ae2a90c1d1198654aba36e2323 Mon Sep 17 00:00:00 2001 From: shikong <919411476@qq.com> Date: Thu, 1 Aug 2024 18:52:16 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=9D=E5=A7=8B=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.py | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 main.py diff --git a/main.py b/main.py new file mode 100644 index 0000000..ba5f276 --- /dev/null +++ b/main.py @@ -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) + \ No newline at end of file