Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Getting object reference error if i run QTP script
#1
Not Solved Exclamation 
I am using a Dot Net Application. It contains a wizard. If i run manually the wizard after clicking on finish button in the last form the wizard gets closed.

I recorded the same in QTP and if i run the script when qtp clicks on finish button i am getting Object reference error and my application gets closed.
Please anyone can help me in this how can i proceed with QTP in this case.

Error:
Exception in <Application name(exe file)>.My.MyApplication. Object reference not set to an instance of an object.
And if i click on the message box my application gets closed. But if i run manually i am not getting this type of error.
Reply
#2
Not Solved
Can you paste the part of recorded script where it fails and gives the error?
may be that can help us to understand the issue.

Reply
#3
Not Solved
Hi Saket,
This is my recorded script. While running at last if QTP clicks on finish button then getting the error. But manually if i run it application not throwing error. I am also attaching the screen shots for the wizard. In the results page we are not entering any thing just clicking on finish only.

Recorded QTP Script
Code:
SwfWindow("ITKK.NET").SwfTreeView("tvITKKTree").Select "AutoCustomer-3-Feb-2010;test compressor class 2.1;1st Stage", micRightBtn
SwfWindow("ITKK.NET").SwfToolbar("SwfToolbar").Select "Operating Condition Wizard"
SwfWindow("ITKK.NET").SwfWindow("Operating Condition").SwfEdit("txtOCName1").Set "Design"
SwfWindow("ITKK.NET").SwfWindow("Operating Condition").SwfEdit("txtSuctionPressure1").Set "1.03"
SwfWindow("ITKK.NET").SwfWindow("Operating Condition").SwfEdit("txtDischargePressure1").Set "3.90"
SwfWindow("ITKK.NET").SwfWindow("Operating Condition").SwfEdit("txtSuctionTemperature1").Set "-90"
SwfWindow("ITKK.NET").SwfWindow("Operating Condition").SwfButton("Next").Click
SwfWindow("ITKK.NET").SwfWindow("Operating Condition").SwfEdit("txtGasAnalysisName2").Set "methane"
SwfWindow("ITKK.NET").SwfWindow("Operating Condition").SwfEdit("txtGasAnalysisName2").Type  micTab
SwfWindow("ITKK.NET").SwfWindow("Operating Condition").SwfEdit("txtHumidity2").Type  micTab
SwfWindow("ITKK.NET").SwfWindow("Operating Condition").SwfComboBox("cmbHumidity2").Type  micTab
SwfWindow("ITKK.NET").SwfWindow("Operating Condition").SwfTable("dgvGases").SelectCell 93,"Gas Name"
SwfWindow("ITKK.NET").SwfWindow("Operating Condition").SwfButton("btnAdd").Click
SwfWindow("ITKK.NET").SwfWindow("Operating Condition").SwfTable("dgvSelectedGases").SelectCell 1,"Proportion"
SwfWindow("ITKK.NET").SwfWindow("Operating Condition").SwfTable("dgvSelectedGases").SetCellData 1,"Proportion","90"
SwfWindow("ITKK.NET").SwfWindow("Operating Condition").SwfTable("dgvGases").SelectCell 119,"Gas Name"
SwfWindow("ITKK.NET").SwfWindow("Operating Condition").SwfTable("dgvSelectedGases").SelectCell 2,"Gas Name"
SwfWindow("ITKK.NET").SwfWindow("Operating Condition").SwfTable("dgvSelectedGases").SelectCell 2,"Proportion"
SwfWindow("ITKK.NET").SwfWindow("Operating Condition").SwfTable("dgvSelectedGases").SetCellData 2,"Proportion","10"
SwfWindow("ITKK.NET").SwfWindow("Operating Condition").SwfButton("Next").Click
SwfWindow("ITKK.NET").SwfWindow("Operating Condition").SwfButton("Finish").Click


Even i modified the script as like below. But no use. Tabhits is just a small function contains for loop.

Code:
Set WshShell = CreateObject("WScript.Shell")
Public Function TabHits(i)
       For j = 1 to i
            WshShell.SendKeys "{TAB}"
       Next
End Function


Code:
SwfWindow("ITKK.NET").Activate
SwfWindow("ITKK.NET").SwfTreeView("tvITKKTree").Select "AutoCustomer-3-Feb-2010;test compressor class 2.1;1st Stage"
SwfWindow("ITKK.NET").SwfTreeView("tvITKKTree").Select "AutoCustomer-3-Feb-2010;test compressor class 2.1;1st Stage", micRightBtn
SwfWindow("ITKK.NET").SwfToolbar("CMSOpen").ShowDropdown "Wizards"
SwfWindow("ITKK.NET").SwfToolbar("CMSOpen").Select "Wizards;Operating Condition Wizard"
SwfWindow("ITKK.NET").SwfWindow("Operating Condition").SwfEdit("txtOCName1").Set "Design"
SwfWindow("ITKK.NET").SwfWindow("Operating Condition").SwfEdit("txtSuctionPressure1").Set "1.03"
SwfWindow("ITKK.NET").SwfWindow("Operating Condition").SwfEdit("txtDischargePressure1").Set "3.90"
SwfWindow("ITKK.NET").SwfWindow("Operating Condition").SwfEdit("txtSuctionTemperature1").Set "-90"
SwfWindow("ITKK.NET").SwfWindow("Operating Condition").SwfButton("Next").Click
SwfWindow("ITKK.NET").SwfWindow("Operating Condition").SwfEdit("txtGasAnalysisName2").Set "methane"
SwfWindow("ITKK.NET").SwfWindow("Operating Condition").SwfTable("dgvGases").SelectCell 0,"Formula"
SwfWindow("ITKK.NET").SwfWindow("Operating Condition").SwfTable("dgvGases").SelectCell 93,"Gas Name"
SwfWindow("ITKK.NET").SwfWindow("Operating Condition").SwfButton("btnAdd").Click
SwfWindow("ITKK.NET").SwfWindow("Operating Condition").SwfTable("dgvSelectedGases").SelectCell 1,"Proportion"
SwfWindow("ITKK.NET").SwfWindow("Operating Condition").SwfTable("dgvSelectedGases").SetCellData 1,"Proportion","90"
SwfWindow("ITKK.NET").SwfWindow("Operating Condition").SwfTable("dgvGases").SelectCell 119,"Gas Name"
SwfWindow("ITKK.NET").SwfWindow("Operating Condition").SwfButton("btnAdd").Click
SwfWindow("ITKK.NET").SwfWindow("Operating Condition").SwfTable("dgvSelectedGases").SelectCell 2,"Proportion"
SwfWindow("ITKK.NET").SwfWindow("Operating Condition").SwfTable("dgvSelectedGases").SetCellData 2,"Proportion","10"
wait(3)
SwfWindow("ITKK.NET").SwfWindow("Operating Condition").SwfButton("Next").Click
wait(3)
Call TabHits(21)
wait(2)
WshShell.SendKeys "{ENTER}"

Hi Saket i am also attaching the screen shots for the same.


Attached Files Image(s)
   
Reply
#4
Not Solved
may be it is related to the way QTP is interacting with controls/COM objects before the AUT is ready to handle the event.

what I can suggest here is to use wait/sync statements to wait the application to finish its internal processes.

Reply
#5
Not Solved
Hi Saket,
The error still appears even if i put a wait time of about 30 Sec to 5 minutes. After clicking on finish normally the wizard closes.

Please any suggestions more?
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  General run error when Exist fails msacks 1 1,899 02-08-2019, 02:12 AM
Last Post: Ankur
  Pass reference to datatable into function smallsteve 2 2,138 09-28-2017, 09:18 PM
Last Post: smallsteve
  How to run multiple iterations only on a set of lines in script amit25007 0 2,490 05-17-2016, 10:48 AM
Last Post: amit25007
  General Object Error(Find Object Error) akhandesh 1 3,696 02-24-2016, 01:05 PM
Last Post: sindhus
Rolleyes The test run cannot continue due to an unrecoverable error neerndg123 3 8,723 09-17-2015, 08:27 PM
Last Post: ananthakumarbe

Forum Jump:


Users browsing this thread: 1 Guest(s)