Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
exception has been thrown by the target of invocation
#1
Solved: 11 Years, 4 Months ago
i keep getting this error and there is no reason that i can mention for it to occur because sometimes it comes up and sometimes it doeesnt. and it comes for the following line :
Code:
SwfWindow("AiCMS Case Management").SwfWindow("Manage Case").SwfToolbar("_ManageCase_Toolbars_Dock_Area").ClickToolbarTool "tbMain","SAVERECEIPT"

Pls help
Reply
#2
Solved: 11 Years, 4 Months ago
make sure to open QTP first then AUT...

Also are you running the application from Eclipse?
Want to fast track your QTP/UFT Learning? Join our UFT Training Course
Reply
#3
Solved: 11 Years, 4 Months ago
no i m not running the application from Eclipse.

In fact now we have moved on to Infragistics 7.3 CLR 2.0 and all seems ok to me with the config files and the sample scripts in Testadvantage also executed as well

But my application after checking all of this still gives the following error though it records correctly.

Code:
Object doesn't support this property or method: 'SwfWindow(...).SwfWindow(...).SwfEdit(...).set'

for the following line
Code:
SwfWindow("AiCMS Case Management").SwfWindow("Search").SwfEdit("txtLastOrg").Set "a"


This is the script file :

Code:
Dim objConnection
Dim objRecordset
set objconnection = createobject("ADODB.Connection")
Set objRecordset = createobject("ADODB.recordset")
strquery = "SELECT top 1 CASE_NUMBER AS 'Case Number',LAST_NAME ,  FIRST_NAME , MIDDLE_NAME , TOTAL_BAL_AMT AS 'Balance Due' FROM [Arizona_Test].[dbo].PARTYSEARCH group by case_number,LAST_NAME , FIRST_NAME ,MIDDLE_NAME,TOTAL_BAL_AMT having count(case_number) = 1 and TOTAL_BAL_AMT  >50"
Set objrecordset = generateDB(objconnection,objrecordset,strquery)
SwfWindow("AiCMS Case Management").SwfToolbar("_Main_Toolbars_Dock_Area_Top_2").SelectRibbonTab "Accounting"
SwfWindow("AiCMS Case Management").SwfToolbar("_Main_Toolbars_Dock_Area_Top_2").ClickRibbonTool "Accounting:Receipting","Payment Receipting"
SwfWindow("AiCMS Case Management").SwfWindow("Search").SwfEdit("txtLastOrg").SetFocus
SwfWindow("AiCMS Case Management").SwfWindow("Search").SwfEdit("txtLastOrg").SetCaretPos 0

SwfWindow("AiCMS Case Management").SwfWindow("Search").SwfEdit("txtLastOrg").Set "a"

SwfWindow("AiCMS Case Management").SwfWindow("Search").SwfToolbar("_Main_Toolbars_Dock_Area_Top").ClickToolbarTool "tbrSearch","Search"
SwfWindow("AiCMS Case Management").SwfTab("SwfTab").CloseTab "Search"

This is the function library for generateDB function

Code:
Public Function generateDB(byref objConnection,byref objRecordset, strQuery)
If objconnection.state  = 0 then
    objConnection.Open Environment.value("DSN") 'Comes from a global variable
end if
    Const adOpenStatic = 3
    Const adLockOptimistic = 3
    Const adUseClient = 3
    
    Set objRecordset = CreateObject("ADODB.Recordset")
                objRecordset.CursorLocation = adUseClient
    objRecordset.CursorType = adopenstatic
    objRecordset.LockType = adlockoptimistic
    
    objRecordset.Source = strQuery
    objRecordset.ActiveConnection = objConnection
    
      objRecordset.Open 'Executes the Query
                set  generateDB=objRecordset
                
End Function


Sometimes it gives me a "General Run Error" at the beginning itself. Sometimes it gives the "exception has been thrown by the target of invocation" error. It acts weird is all that i can say.
So now how can we resolve this?
Reply
#4
Solved: 11 Years, 4 Months ago
See if .type method works .

If it works you can use, Type "a" instead of Set "a"
Want to fast track your QTP/UFT Learning? Join our UFT Training Course
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  (Zephyr) REST API invocation HKARBAS 0 2,501 06-03-2016, 08:38 PM
Last Post: HKARBAS
  [UFT] SelectRow and Exception robertosalemi 1 2,506 03-23-2016, 10:36 PM
Last Post: robertosalemi
  External component has thrown an exception. mharps 1 7,133 05-28-2014, 10:07 AM
Last Post: mharps
Exclamation RE: QTP - Exception Handling Unleash Rajesh 2 5,032 07-05-2011, 08:54 PM
Last Post: rajpes
  Exception Handling in QTP sudhirzpatil 2 13,001 12-22-2010, 10:05 AM
Last Post: sudhirzpatil

Forum Jump:


Users browsing this thread: 1 Guest(s)