Applies to TestComplete 14.20, last modified on September 11, 2019

Description

In Python code, you can use __getprop__ to get an object’s property value given the property name as a string. __getprop__ works similar to aqObject.GetPropertyValue, but is easier to use in Python.

Declaration

Obj.__getprop__(PropertyNameParam1Param2, ..., ParamN)

Obj Any object that supports the IDispatch interface
PropertyName [in]    Required    String    
Param1 [in]    Optional    Variant    
Param2 [in]    Optional    Variant    
...
ParamN [in]    Optional    Variant    
Result Variant

Applies To

IDispatch objects, for example, TestComplete scripting objects (Sys, Log), test objects obtained from applications (Aliases.browser), COM objects, and others.

Parameters

PropertyName

A string containing the name of the property whose value you want to get.

Param1, Param2, ..., ParamN

If the property has parameters, such as property[param1, param2], specify the parameter values.

Result Value

The property value.

Remarks

__getprop__ is the only way to get the value of a parameterized property using the default parameter values. Instead of

obj.property[]

you must use

obj.__getprop__("property")

Example

Python

def Test():
  username = Sys.__getprop__("UserName")
  Log.Message(username)

See Also

__callmethod__ Method
__setprop__ Method
Python - Specifics of Usage

Highlight search results