Thursday, November 17, 2011

Pywinauto

Pywinauto is a tool used with python for Automation Windows applications.

Example 1: Start or Connect any application....
   ff =  application.Application().start_(r"c:\program files\Mozilla Firefox\Firefox.exe")      #starts Firefox
   ff = application.Application().connect_(path = r"c:\program files\Mozilla Firefox\Firefox.exe")      #connects Firefox process
      In above syntax 'r' is for raw string...

    Once you started or connected to app you can find all components/controls on the window
       app = application.Application().start_(r"path_to_your_app")
       w = app.window_()
       w.print_control_identifiers()    #Prints all components on window i.e. Buttons,textboxes, ListBox etc..