beuaaa / pywinauto_recorder

A record-replay tool to automate GUI via pywinauto
https://pywinauto-recorder.readthedocs.io/
MIT License
127 stars 24 forks source link

How to simplify a path #34

Closed batara666 closed 2 years ago

batara666 commented 2 years ago

current code that are generated by pywinauto_recorder:

with Window(u"WhatsApp||Pane"):
    with Region(u"WhatsApp Desktop||Document->Search or start new chat Search or start new chat Archived Chat list Keep your phone connected WhatsApp connects to your phone to sync messages. To reduce data usage, connect your phone to Wi-Fi.||Group->||Group"):
        left_click(u"Voice call||Button")

It is possible to simplify the path below? (or even make it more stateless)

Search or start new chat Search or start new chat Archived Chat list Keep your phone connected WhatsApp connects to your phone to sync messages. To reduce data usage, connect your phone to Wi-Fi.

Edit:

Anyway, Thanks for the software, this really saves a lot of times

github-actions[bot] commented 2 years ago

Thank you very much for sharing this first issue.

beuaaa commented 2 years ago

Hi @batara666,

Glad you found the solution.

You can try:

with Window(u"WhatsApp||Pane"):
    with Region(u"*"):
        left_click(u"Voice call||Button")

or simpler:

left_click(u"WhatsApp||Pane->*->Voice call||Button")

In version 0.6.0 of Pywinauto Recorder, the support of * is improved. Version 0.6.0 should be available very soon. There will also be a video tutorial to explain all the possibilities to identify an element with a path.

Do not hesitate to let me know your wishes of evolution.

batara666 commented 2 years ago

yes sir, I use the * wildcard, thanks for the reply <3

edit:

wow thankyou for this part: left_click(u"WhatsApp||Pane->*->Voice call||Button")