From 8e7dd21839fdf6285d68e84a5d9e3102c924c7e2 Mon Sep 17 00:00:00 2001 From: shikong <919411476@qq.com> Date: Thu, 20 Mar 2025 03:32:11 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0=E7=99=BB=E5=BD=95?= =?UTF-8?q?=E6=B5=81=E7=A8=8B=E8=87=AA=E5=8A=A8=E5=8C=96=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 在tab访问指定URL后,增加了等待URL变化并自动处理登录流程的逻辑。如果URL以"/auth/login"结尾,自动输入用户名和密码并点击登录按钮,以确保后续操作在登录状态下进行。 --- main.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/main.py b/main.py index ed7575c..f962ed9 100644 --- a/main.py +++ b/main.py @@ -23,8 +23,16 @@ executor.submit(listener.network.network_listener, tab) tab.get(url='http://127.0.0.1:24613') -tab.change_mode() +tab.wait.url_change(text="/auth/login", timeout=3, raise_err=False) + +if tab.url.endswith("/auth/login"): + tab.wait.doc_loaded() + tab.actions.move_to("@@t()=input@@type=text").click().type("shikong") + tab.actions.move_to("@@t()=input@@type=password").click().type("123+AbC") + tab.actions.move_to("@@t()=button@@text():登录").click() + +tab.change_mode() items = tab.eles("t:body") for item in items: