pywinauto

Pywinauto typing in the wrong field


I'd appreciate any comments on this issue.

I'm using PywinAuto to automate a DeskTop application. And I'm executing this command to fill out a field in the screen==>

app.SISLOGSistemadeinformaçõeslogísticasRodoviário.Pessoa.Edit.set_edit_text("077775555000100")

But it is filling the wrong field. Below is a print of the application tree. Looking to the picture and take in account the command that I'm using, is it possible to identify what is wrong..?

Thank in advance for any comments.

enter image description here


Solution

  • Try .Edit2.set_edit_text("..."). Magic attribute lookup is typo resistant (approximate to some degree), also it follows "find first" approach. Another non-obvious thing is that Edit0 and Edit1 is matched to the same element, while Edit2 is the next one, Edit3 is the third one and so on.

    P.S. Maybe it's better to switch Inspect.exe to "UI Automation" mode to see more properties.