pywinauto.windows.application

Implementation of Application class for MS Windows platform.

class pywinauto.windows.application.Application(backend='win32', datafilename=None, allow_magic_lookup=True)

Bases: pywinauto.base_application.BaseApplication

Represents an application

__getattribute__(attr_name)

Find the specified dialog of the application

__getitem__(key)

Find the specified dialog of the application

GetMatchHistoryItem(index)

Should not be used - part of application data implementation

WriteAppData(filename)

Should not be used - part of application data implementation

connect(**kwargs)

Connect to an already running process

The action is performed according to only one of parameters

Parameters:
  • pid – a process ID of the target
  • handle – a window handle of the target
  • path – a path used to launch the target
  • timeout – a timeout for process start (relevant if path is specified)

See also

pywinauto.findwindows.find_elements() - the keyword arguments that are also can be used instead of pid, handle or path

cpu_usage(interval=None)

Return CPU usage percent during specified number of seconds

is64bit()

Return True if running process is 64-bit

is_process_running()

Check that process is running.

Can be called before start/connect.

Return True if process is running otherwise - False.

kill(soft=False)

Try to close (optional) and kill the application

Dialogs may pop up asking to save data - but the application will be killed anyway - you will not be able to click the buttons. This should only be used when it is OK to kill the process like you would do in task manager.

start(cmd_line, timeout=None, retry_interval=None, create_new_console=False, wait_for_idle=True, work_dir=None)

Start the application as specified by cmd_line

pywinauto.windows.application.assert_valid_process(process_id)

Raise ProcessNotFound error if process_id is not a valid process id

pywinauto.windows.application.process_from_module(module)

Return the running process with path module

pywinauto.windows.application.process_get_modules()

Return the list of processes as tuples (pid, exe_path)

pywinauto.windows.application.process_module(process_id)

Return the string module name of this process