First, I'd like to say that I've been fairly impressed with pywinauto so far. I'm evaluating it for use in our organization for some test automation, and it's looking fairly promising thus far.
I do have a couple of questions, though:
1. Any idea how to access a System Tray process, and perform actions on it? One of our applications runs in the System Tray, and can respond to right-clicks to bring up a configuration dialog. To really automate things, it would be nice if we could grab that, too.
2. Is there a way to uniquely identify an input text box, other than the text that is currently in it? We have a dialog that has some labels, a couple of buttons, and three textboxes for input. The only way I can see to get them uniquely (they're all reporting the same Class and FriendlyClassName) is by the Texts value. Any better way?
(copy of reply from Mail List)
I have done some testing of sending WM_CONTEXTMENU messages to windows
and capturing the menu - but it is not production ready at all yet.
If the system tray uses a hidden window then you could use
app.window(visible_only = False, title = "xxx", etc)
Other then that I do not know that much about system tray stuff. I
could maybe see about asking Windows to tell me what icons are there
and where they are (to make clicking on them easier).
With the current released stream (0.1.3 and earlier) you can identify
controls in a few different ways:
app.Dlg.Title # Where title is the text on the control (not what you want)
app.Dlg.FriendlyClassName # the FriendlyClassName for an Edit
Control is Edit :-)
app.Dlg.TitleFriendlyClassName # if title is not empty
This last one is not all that usefull in the current code stream
unless you have many items with the same title - but different control
For now what you need is probably something like:
app.Dlg.Edit1 (1st edit control in the dialog)
app.Dlg.Edit2 (2nd edit control in the dialog)
In the release I am currently working on - the code also looks for the
closest text above and/or to the left of the control so you could
app.Dlg.UserNameEdit if there is a "username" edit field.
Sorry for not getting back to you sooner - I have been traveling
(unexpectedly) and haven't had email access for some days. No harm
posting here - as I check my email more often then sourceforge forums.
If you have any suggestions that would make using pywinauto easier for
you - then please let me know and I will see what I can do.
Log in to post a comment.
Sign up for the SourceForge newsletter:
You seem to have CSS turned off.
Please don't fill out this field.