Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
QTP 9.2 .Net
#1
Not Solved
I am running QTP 9.2 with .net and ActiveX addins. The click in the code does not work consistently. When it errors, I get "object not found". Does anyone have any ideas on the problem?


Code:
Function fnClickKeyPadKey(strKeyName)

    Dim objswfWinDesc, objswfWinColl
    Dim objswfObjDesc, objswfObjColl
    strFound = False
    
    If Window(POS).Window(Keypad).Exist Then
        Set objswfWinDesc = Description.Create()
        objswfWinDesc("swftypename").Value = "FLIBCustomControlBridgeNet.ButtonWindow"

        Set objswfWinColl = Window(POS).Window(Keypad).ChildObjects(objswfWinDesc)
        For i = 0 to objswfWinColl.Count-1
            Set objswfObjDesc = Description.Create()
            objswfObjDesc("swftypename").Value = "FLIBCustomControlBridgeNet.ButtonControl"

            Set objswfObjColl = objswfWinColl(i).ChildObjects(objswfObjDesc)
            
            If objswfObjColl.Count = 1 Then
                strName = objswfObjColl(0).GetROProperty("text")
                strActualName = UCase(Replace(Replace(Replace(Trim(strName), VbCrLf, " "), VbTab, " "), " ", ""))
                strExpectedName = UCase(Replace(Replace(Replace(Trim(strKeyName), VbCrLf, " "), VbTab, " "), " ", ""))
            
                If  strActualName = strExpectedName  Then

                    objswfWinColl(i).Click 1, 1
            
                    strFound = True
                    Set objswfObjDesc = Nothing
                    Set objswfObjColl = Nothing
            
                    Exit For
              
                End If
                
            End If
            
            Set objswfObjDesc = Nothing
            Set objswfObjColl = Nothing
            
         Next

        If strFound Then
             fnClickKeyPadKey = True
        Else
            fnClickKeyPadKey = False
        End If
        
          Set objswfWinDesc = Nothing
          Set objswfWinColl = Nothing
   Else
        Print  "The Parent Object not found"            
    End If
    
End Function
Reply
#2
Not Solved
Hi,

Just replace Dim by Public in your code.
From:
Code:
Dim objswfWinDesc, objswfWinColl
    Dim objswfObjDesc, objswfObjColl

To:
Code:
Public objswfWinDesc, objswfWinColl
    Public objswfObjDesc, objswfObjColl

It worked for me when I was getting this kind of error for some other scenerio.
Reply
#3
Not Solved
Thank you, I will give it a try.
Reply
#4
Not Solved
Hi

I am also trying to execute QTP test cases from .net

I have following scenerio
Machines A and B.
Machine A has Test Scripts and related libraries.
Machine B has only QTP installed.

I have created a .vbs file on Machine A which launches QTP on Machine B and run Test cases of Machine A.

I want to execute this .vbs file from VSTS.

Do you have any idea how to do this.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  QTP takes long time to click on asp.net forms arpan 0 1,922 10-16-2013, 09:30 PM
Last Post: arpan
  QTP is not identifying the objects in .net application. qtpexpert 0 2,694 03-12-2013, 12:59 PM
Last Post: qtpexpert
Exclamation .Net Addin for QTP 9.1(Urgent) shaam 1 3,196 07-15-2011, 07:28 PM
Last Post: Ankur
  Dot Net Factory Button click to run action in QTP nutsndips 1 4,479 06-21-2011, 08:37 PM
Last Post: nutsndips
  How QTP records context menu in .net GUI applications vanibandla 1 4,603 02-25-2011, 06:32 AM
Last Post: basanth27

Forum Jump:


Users browsing this thread: 1 Guest(s)