Forum Discussion

smarshall's avatar
smarshall
Occasional Contributor
11 years ago

438 Object doesn't support this property or method error message

We have a DDT Framework going on whereas we will be doing browser and Delphi application testing.  We have the browser testing in place but want to add the Delphi AUT to the framework.



The Excel document contains, either the object name or the xpath for the object to be manipulated which is then passed to the below script:  As one can see from the below code, we have tried to create the object using the string, append to the object's name escaping the quotes, append the object's name without escaping the quotes and have even fooled around with setting up an ODT but nothing has worked and all throw the above error.  How can we set the existing AUT object using a passed string?  Thanks in advanced.



    Select Case UCase(pstrFindMethod)

        

        Case "NATIVEWEBOBJECT"

            If IsNull(pstrTagName) Then pstrTagName = ""

            Set objGetObject = objGetPage(pstrPageURL, gstrBrowserType).NativeWebObject.Find(pstrPropertyName, pstrPropertyValue, pstrTagName)

                     

            If ObjectExists(objGetObject) = False Then

              Set objGetObject = Nothing

              Log.Error("The Object " & pstrPropertyName & pstrPropertyValue & pstrTagName & " does not exist.")

            End If

            

        Case "EVALUATEXPATH"

            Set objGetObject = objGetPage(pstrPageURL, gstrBrowserType).EvaluateXPath(pstrPropertyName)(0)



            If ObjectExists(objGetObject) = False Then

              Set objGetObject = Nothing

              Log.Error("The Object " & pstrPropertyName & pstrPropertyValue & pstrTagName & " does not exist.")

            End If

            

        Case "NATIVEOBJECT"

'            objGetObject = CreateObject(pstrPropertyName)

'            CreateStackClass

'            Set Stack = ODT.Classes.New("ClsStack")

'            

'            Sys.Refresh

''            Stack.PUSH(pstrPropertyName)

'            For y =0 to Sys.ChildCount -1

'                if Sys.Child(i)

'            Next



            if inStr(pstrPropertyName, "Sys.Process(" & Chr(34) & "EMDs" & Chr(34) & ")") > 0 Then

              pstrPropertyName = Right(pstrPropertyName, len(pstrPropertyName) -20)

            End If

            

            'Remove all quotes from the string

            If inStr(pstrPropertyName, Chr(34)) > 0 Then

                For y = 1 to len(pstrPropertyName)

                  If Right(left(pstrPropertyName, y), 1) = chr(34) Then

                      tstrPropertyName = tstrPropertyName & Chr(34) & Chr(34) & Chr(34)

                  else

                      tstrPropertyName = tstrPropertyName & Right(left(pstrPropertyName, y), 1)

                  End if

                Next

            End If

            pstrPropertyName = tstrPropertyName

            

            Set objGetObject = Sys.Process("EMDs") & "." & pstrPropertyName            

    End Select

2 Replies

  • smarshall's avatar
    smarshall
    Occasional Contributor
    OK have found that all of the code within NativeObject is superfluous.



    Eval(pstrPropertyName) returns the object; however, when adding "Set objGetObject =", Test complete is throwing a syntax error?



            Case "NATIVEOBJECT"

                Set objGetObject = Eval(pstrPropertyName)    

                        

        End Select





    Please Advise.
  • smarshall's avatar
    smarshall
    Occasional Contributor
    OK a clearing of the temp files (and reboot of TC) fixed the syntax errors.  All is working now.