__setprop__ Method

Applies to TestComplete 14.61, last modified on April 22, 2021

Description

In Python code, you can use __setprop__ to assign a value to an object’s property given the property name as a string.

__setprop__ works similar to aqObject.SetPropertyValue, but is easier to use in Python.

Declaration

Obj.__setprop__(PropertyNameParam1Param2, ..., Value)

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

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 set.

Param1, Param2, ..., ParamN

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

Value

The value to assign to the property.

Result Value

None.

Remarks

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

obj.property[] = value

you must use

obj.__setprop__("property", value)

Example

Python

def Test():
  Sys.__setprop__("Clipboard", "test")
  Log.Message(Sys.Clipboard)

See Also

__callmethod__ Method
__getprop__ Method
Python - Specifics of Usage

Highlight search results