Forum Discussion
AlexanderM
Staff
15 years agoHello Andy,
Currently, it is necessary to add parentheses when obtaining TestComplete objects. Otherwise, some methods such as GetProperties will work incorrectly with these objects. We are going to change this behavior in one of future versions of TestComplete, so it won't be necessary to add parentheses when obtaining TestComplete objects from within a connected application.
Besides that, TestComplete objects don't implement the ToString() method. You need to convert it to the appropriate type using the following syntax:
So, to obtain the innerText property of the totalMetersForm object, use the following code in your connected application:
Besides that, you can iterate through all properties of the totalMetersForm object and obtain their values using the following code:
C# code provided in the documentation should work correctly in Connected applications. If you have found some sample code that does not work, please specify the exact help topic and the code snippet(s) that does not work. We will look into this.
Currently, it is necessary to add parentheses when obtaining TestComplete objects. Otherwise, some methods such as GetProperties will work incorrectly with these objects. We are going to change this behavior in one of future versions of TestComplete, so it won't be necessary to add parentheses when obtaining TestComplete objects from within a connected application.
Besides that, TestComplete objects don't implement the ToString() method. You need to convert it to the appropriate type using the following syntax:
string text = (string)totalMetersForm["innerText"];
So, to obtain the innerText property of the totalMetersForm object, use the following code in your connected application:
var totalMetersForm = totalMetersCell["panelTabbody"]["panelNncDivlist"]["frameNncFrmlist"]["frameNncListMain"]["formNnclist"](); //parentheses are required!
string text = (string)totalMetersForm["innerText"];
Besides that, you can iterate through all properties of the totalMetersForm object and obtain their values using the following code:
var totalMetersForm = totalMetersCell["panelTabbody"]["panelNncDivlist"]["frameNncFrmlist"]["frameNncListMain"]["formNnclist"](); //parentheses are required!
var props = Connect.aqObject["GetProperties"](totalMetersForm);
var prop = props;
while ((bool)props["HasNext"])
{
prop = props["Next"];
string name = prop["Name"]();
string val = Connect.aqConvert["VarToStr"](prop["Value"]());
}
It seems like a lot of the different functions with example code in the documentation don't work when you implement them as C# code in the Visual Studio project. Something I'm doing wrong? Or just lack of support for Connected Applications?
C# code provided in the documentation should work correctly in Connected applications. If you have found some sample code that does not work, please specify the exact help topic and the code snippet(s) that does not work. We will look into this.