I'm using pywinauto (the latest from the new github) to automate logging in to another program. The "Sign in" window has a bunch of buttons, and two fields, one for user name and one for password.
My problem is that the user name and password 'edit' control identifiers have the same Access name: ['1', '0', 'Edit']. There is no "Edit2".
When I use
sign_in.print_control_identifiers()
It still only shows the one edit property. How do I access this other edit control?
update with pictures with the demo company file:
Here is the LOGIN window: http://imgur.com/VwS9w0b
Here is the mouse hovering over password: http://imgur.com/6HWQVlZ
Password field clicked, its called edit1 as well! http://imgur.com/GUnTVrK
Swapy output : http://imgur.com/LJB99y1
A solution I found was to simulate a "tab" key
sign_on.TypeKeys("{TAB}")
But this is not a great solution because if another window were to take focus at the time of the TAB then the script would sent the tab to that window.
I'm not sure which version of Pywinauto you are using. There is a revived one on GitHub (https://github.com/pywinauto/pywinauto). You can access controls as elements of a dictionary:
Highlighting a GUI element can also help to understand what element you refer to:
Update the answer with an example of walking through all control's children and highlight them. This way you can see if you have access to the "password" field.