Menu

how to know methods of every object

powerccna
2010-03-26
2013-05-28
  • powerccna

    powerccna - 2010-03-26

    I am newer to pywinauto, my company develop first windows application.I am using pywinauto to implement automated testing, but i encounter serious problems, it breaks me go further. my question is how to know methods of every object. for example as blow code form pywinauto official site
    >>> from pywinauto import application
    >>> app = application.Application.start("notepad.exe")
    >>> app.Notepad.MenuSelect("File->SaveAs")
    >>> dir(app.Notepad)

    >>> app.SaveAs.ComboBox5.Select("UTF-8")
    how i can konw app.Notepad has method MenuSelect()  and  app has method SaveAs? as you see the dir(app.Notepad) can know whose method.

    Thanks in advanced!

     
  • Mark Mc Mahon

    Mark Mc Mahon - 2010-03-26

    Hi,

    I would suggest two things…
    a) look at the docs (hopefully not too far out of date)
    b) run
    >>> dir (app.Notepad.WrapperObject()))

    The reason that app.Notepad doesn't return a useful list of methods is because it is an intermediate object. It is a WindowSpecification, it doesn't represent a window as such - but the specification of a window, and as such until you run HwndWrapper action on it - you are not sure which type of object it is.

    Hope this helps,
       Mark

     

Log in to post a comment.