diff --git a/main.py b/main.py index abfdeef..703e4e8 100644 --- a/main.py +++ b/main.py @@ -99,7 +99,9 @@ async def douyin_task(item: Device): return Response(code=500, msg="设备 {} 不存在".format(item.serial)) d = devices[item.serial] d.app_start("com.ss.android.ugc.aweme", stop=False) - tasks.douyin.click_search(d) + tasks.douyin.click_search_icon(d) + tasks.douyin.input_search_text(d, "老耗") + d.xpath("老耗游戏").click() if __name__ == '__main__': diff --git a/tasks/douyin/__init__.py b/tasks/douyin/__init__.py index c5e5e92..3e8dd76 100644 --- a/tasks/douyin/__init__.py +++ b/tasks/douyin/__init__.py @@ -1,7 +1,11 @@ from uiautomator2 import Device -def click_search(d: Device): +def click_search_icon(d: Device): (d .xpath('//*[@resource-id="com.ss.android.ugc.aweme:id/ybv"]/android.widget.Button[1]/android.widget.FrameLayout[1]') .click()) + +def input_search_text(d: Device, text: str): + (d + .xpath('//*[@resource-id="com.ss.android.ugc.aweme:id/et_search_kw"]').set_text(text))