Getting java.lang.NullPointerException

2011-11-27
2013-05-28
  • Hi guys,

    I am new to pywinauto module in Python and trying to automate a JAVA based GUI using pywinauto.
    Pretty successful till now. What is the difference between manually mouse clicking on an application and pywinauto's click or clickinput method? Because when i am using pywinauto - click or ClickInput method i get java.lang.NullPointerException but when i try physically through mouse, i see my app working. Can anyone help why click or clickinput not behaving same as manually clicking through mouse???

    Thanks in Advance..

     
  • Mark Mc Mahon
    Mark Mc Mahon
    2011-11-28

    Hi,

    Click() sends Windows messages  to *simulate* a mouse click - the control does not need to be visible on the screen.
    ClickInput() uses the real documented way and should be identical to a user generated mouse click (hopefully I don't have a bug there - but that part of code has been quite stable).

    My guess is that maybe things are happening too fast and there is a bug in your app somewhere? Can you try adding a sleep() before sending the input  (or set the timing to slow maybe).

    That is the best I can suggest for now, hope it helps,
      Mark

     
  • Thanks Mark.! I got whats the issue. I instantiated my app through python which was in other directory. And app was trying to find dependent libraries in python root folder instead of its application package,(Don't know why so?) hence returning Null pointer, No issues with Click or ClickInput(). Thanks once again :-)