微信 测试
This commit is contained in:
parent
a2a1790b70
commit
7ffd4147ea
1
main.py
1
main.py
@ -125,6 +125,7 @@ async def wechat_search_task(item: WechatSearchInput):
|
||||
tasks.wechat.click_search_btn(d)
|
||||
tasks.wechat.input_search_text(d, item.text)
|
||||
tasks.wechat.click_search_result(d)
|
||||
tasks.wechat.input_chat_text(d, time.strftime("%Y-%m-%d %H:%M:%S", time.localtime()))
|
||||
|
||||
if __name__ == '__main__':
|
||||
uvicorn.run('main:app', host='0.0.0.0', port=8000, reload=True)
|
||||
|
@ -26,7 +26,7 @@ def input_search_text(d: Device, text: str):
|
||||
|
||||
def click_search_result(d: Device):
|
||||
selector = d.xpath('//*[@resource-id="com.tencent.mm:id/kbo"]')
|
||||
selector.wait(timeout=3)
|
||||
selector.wait(timeout=5)
|
||||
elements = selector.all()
|
||||
print(elements)
|
||||
|
||||
@ -34,3 +34,17 @@ def click_search_result(d: Device):
|
||||
elements[0].click()
|
||||
else:
|
||||
logging.warning("未找到组件")
|
||||
|
||||
|
||||
def input_chat_text(d: Device, text: str):
|
||||
selector = d.xpath('//*[@resource-id="com.tencent.mm:id/bkk"]')
|
||||
selector.wait(timeout=5)
|
||||
|
||||
if selector.exists:
|
||||
selector.set_text(text)
|
||||
else:
|
||||
logging.warning("未找到组件")
|
||||
|
||||
selector = d.xpath('//*[@resource-id="com.tencent.mm:id/bql"]')
|
||||
selector.wait(timeout=1)
|
||||
selector.click()
|
||||
|
Loading…
Reference in New Issue
Block a user