控件搜索测试

This commit is contained in:
shikong 2024-08-01 22:20:29 +08:00
parent 2f7abfec96
commit b019fc0aaf
Signed by: Shikong
GPG Key ID: BD85FF18B373C341
2 changed files with 8 additions and 2 deletions

View File

@ -99,7 +99,9 @@ async def douyin_task(item: Device):
return Response(code=500, msg="设备 {} 不存在".format(item.serial)) return Response(code=500, msg="设备 {} 不存在".format(item.serial))
d = devices[item.serial] d = devices[item.serial]
d.app_start("com.ss.android.ugc.aweme", stop=False) 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__': if __name__ == '__main__':

View File

@ -1,7 +1,11 @@
from uiautomator2 import Device from uiautomator2 import Device
def click_search(d: Device): def click_search_icon(d: Device):
(d (d
.xpath('//*[@resource-id="com.ss.android.ugc.aweme:id/ybv"]/android.widget.Button[1]/android.widget.FrameLayout[1]') .xpath('//*[@resource-id="com.ss.android.ugc.aweme:id/ybv"]/android.widget.Button[1]/android.widget.FrameLayout[1]')
.click()) .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))