Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can i find available dialogs ,controls of an application in pywinauto?

I am using pywinauto in windows 7 and I am searching for a way to find the available dialogs and controls of an application.The following is an example:

from pywinauto import application
import time

app=application.Application()
app.connect_(title_re = ".*Notepad", class_name = "Notepad")

You can start or connect to an application with pywinauto.But I don't know how can I find whats available in notepad.Any ideas ? Thanks.

like image 676
IordanouGiannis Avatar asked Nov 04 '11 11:11

IordanouGiannis


People also ask

How do I close an application in Pywinauto?

You can check to see if there's a specific hotkey to close the program. However, the easiest way to do this is to send Alt-F4.

What is UIA in Pywinauto?

Bases: pywinauto.base_wrapper.BaseWrapper. Default wrapper for User Interface Automation (UIA) controls. All other UIA wrappers are derived from this. This class wraps a lot of functionality of underlying UIA features for working with windows. Most of the methods apply to every single element type.


1 Answers

This is working for me. Source: http://pywinauto.github.io/docs/getting_started.html

from pywinauto import application

app = application.Application.Start("Notepad.exe")
app.Notepad.print_control_identifiers()
app.Notepad.MenuSelect("Edit->Replace")
app.Replace.print_control_identifiers()

Or you can use Swapy to see all controls and class names

enter image description here

like image 133
LittlePanda Avatar answered Sep 22 '22 21:09

LittlePanda