微信 测试
This commit is contained in:
parent
7ffd4147ea
commit
0bdf5ac51b
3
main.py
3
main.py
@ -125,7 +125,8 @@ async def wechat_search_task(item: WechatSearchInput):
|
|||||||
tasks.wechat.click_search_btn(d)
|
tasks.wechat.click_search_btn(d)
|
||||||
tasks.wechat.input_search_text(d, item.text)
|
tasks.wechat.input_search_text(d, item.text)
|
||||||
tasks.wechat.click_search_result(d)
|
tasks.wechat.click_search_result(d)
|
||||||
tasks.wechat.input_chat_text(d, time.strftime("%Y-%m-%d %H:%M:%S", time.localtime()))
|
tasks.wechat.input_chat_text(d, time.strftime("[AI] %Y-%m-%d %H:%M:%S", time.localtime()))
|
||||||
|
tasks.wechat.get_last_chat_text(d)
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
uvicorn.run('main:app', host='0.0.0.0', port=8000, reload=True)
|
uvicorn.run('main:app', host='0.0.0.0', port=8000, reload=True)
|
||||||
|
@ -48,3 +48,13 @@ def input_chat_text(d: Device, text: str):
|
|||||||
selector = d.xpath('//*[@resource-id="com.tencent.mm:id/bql"]')
|
selector = d.xpath('//*[@resource-id="com.tencent.mm:id/bql"]')
|
||||||
selector.wait(timeout=1)
|
selector.wait(timeout=1)
|
||||||
selector.click()
|
selector.click()
|
||||||
|
|
||||||
|
|
||||||
|
def get_last_chat_text(d: Device):
|
||||||
|
selector = (d.xpath('//*[@resource-id="com.tencent.mm:id/bn1"]')
|
||||||
|
.child('//*[@resource-id="com.tencent.mm:id/bkl"]'))
|
||||||
|
elements = selector.all()
|
||||||
|
|
||||||
|
if len(elements) > 0:
|
||||||
|
last_element = elements[-1]
|
||||||
|
print(last_element.text)
|
||||||
|
Loading…
Reference in New Issue
Block a user