Forum Discussion

hhowe's avatar
hhowe
Occasional Contributor
8 years ago

Script Extension property returning error in Python script

I'm having issues with a script extension I wrote in VBScript and am trying to use in a Python script. The extension works fine from within a VBScript test. I'm running TestComplete12.30.

 

def MyTestFunction():

  MyResult = AEWeb.NavItemVisible("Views", "Active Process Information")

 

I've also tried:

 

  MyResult = str(AEWeb.NavItemVisible("Views", "Active Process Information"))

 

The NavItemVisible property simply returns True or False boolean (but as a Variant because that's what VBScript returns).

 

The error I receive for both versions of the call above is:

TypeError
'IDispatchIndexedPropertyWrapper' object is not callable
Error location:
Unit: "ResMan6.0\WebUI2\Script\Views"
Line: 3473 Column: 1.

 

Thoughts or help would be greatly appreciated.

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor

    I believe you need to use the https://support.smartbear.com/testcomplete/docs/reference/language/python/getprop-method.html

     

    It's similar to the JavaScript $get method.  The reason being is that what is being returned is being returned as a COM object...

     

    Just verifying... NavItemVisible is a property, not a method in your Script Extension, correct?

     

    If it is a property, your syntax should be

     

    def MyTestFunction():

        MyResult = AEWeb.__getprop__("NavItemVisible", "Views", "Active Process Information")

     

    See the section here https://support.smartbear.com/testcomplete/docs/scripting/specifics/python.html about using parameterized properties.

    • hhowe's avatar
      hhowe
      Occasional Contributor

      Thanks, Robert. Exactly what I was looking for and suspected may exist. Clearly I was neither looking in the right place, nor performing the right searches, nor asking the right people. Somewhat surprisingly, I was able to call a method from the very same script extension without using the __callmethod__ function (but I'm not going to question it!).

       

      You're a terrific resource. I appreciate the prompt and accurate feedback.

       

      Appreciatively,

      Heath

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor
    I think it has to do with how the method is implemented, parameter calls, etc. But glad this helped!