Ask a Question

modularize object path

SOLVED
iamaqa
New Contributor

modularize object path

TestComplete version: 15.42.9.7 x64

I'm using python for the Unit test script.

 

Question: how do you modularized an object path in TestComplete?

 

example

 

from this:

aqObject.CheckProperty(Aliases.ApplicationName.HwndSource_MainWindow.MainWindow.StatusBar.StatusBarItem.TextblockJohnDoe, "WPFControlText", cmpEqual, "john.doe")

 

to something like this:

UserName= "john.doe"

TextBlock="Aliases.ApplicationName.HwndSource_MainWindow.MainWindow.StatusBar.StatusBarItem.Textblock"

 

aqObject.CheckProperty(TextBlock+UserName.title().replace(".",""), "WPFControlText", cmpEqual, UserName)

1 REPLY 1
iamaqa
New Contributor

I found a solution and it's working!

need to use the eval() function to convert string to a python object

 

aqObject.CheckProperty(eval(TextBlock+UserName.title().replace(".","")), "WPFControlText", cmpEqual, UserName)

cancel
Showing results for 
Search instead for 
Did you mean: