Micro Focus QTP (UFT) Forums
ERROR : Object reference not set to an instance of an object. - Printable Version

+- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums)
+-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP)
+--- Forum: UFT / QTP Beginners (https://www.learnqtp.com/forums/Forum-UFT-QTP-Beginners)
+--- Thread: ERROR : Object reference not set to an instance of an object. (/Thread-ERROR-Object-reference-not-set-to-an-instance-of-an-object--7845)



ERROR : Object reference not set to an instance of an object. - Suyashxp - 01-27-2014

Hi all ,

I am facing a issue while automating a WPF app on Windows

I added Plugin "WPF" as needed and added WEB , ActiveX and Vbscripts as plugin while Opening QTP app

while recording it recorded Properly but on rerun it gets failed with below error


ERROR :-
Object reference not set to an instance of an object.
Line (13): "WpfWindow("MYAPP1").WpfButton("OK").Click".

so I tried debuging

i code like

Code:
Dim Varname
Varname  = WpfWindow("MYAPP1").WpfButton("OK").GetROProperty("text")
msgbox(Varname)

WpfWindow("MYAPP1").WpfButton("OK").Click

Varname Message Box shows "OK" , so it means object is Recognizes. - BUT IT FAILS IN NEXT LINE
I checked Obj repository and checked OK button is there !!!


also tried

Code:
Set WinObject = WpfWindow("MYAPP1").WpfButton("OK")
If  WinObject.Exist Then
            msgbox("yes")
    else
        msgbox("NO")
End If

It gives error as -
General run error.
Line (9): "Set WinObject = WpfWindow("MYAPP1").WpfButton("OK")".

FUNNEST Part is , i DOONO Some times both above code works and "OK" Button get pressed !!! Smile

I don't want to Use Descriptive programming as get all Child Objects , loop and get the Object which is required


RE: ERROR : Object reference not set to an instance of an object. - jacosta - 01-28-2014

Hi,
With description programming is the same?


RE: ERROR : Object reference not set to an instance of an object. - ursprasadp - 12-30-2014

Hi All,
Is there any solution for this issue ??