I'm trying to write simple automation test using TestComplete in C#. (Not JScript/C# Script, just C#)
I'm using their libraries as you can see here: https://support.smartbear.com/viewarticle/74747/
and specifically their 'var' type: https://support.smartbear.com/viewarticle/68791/
I'm trying to identify all the elements on the screen according to specific key and value, using the method "FindAll" (https://support.smartbear.com/viewarticle/71244/)
var a = someProcess["FindAll"]("text", "Simulate", 200, false);
In debug mode I can see that "a" has two encapsulated elements that he found and this line passes successfully.
The problem: I'm trying to get the first element, using the line
var b = a["0"];
and get a 'MissingMethodException'.
If I try to use
var b = a(0);
it says I'm trying to use variable as a function.
I couldn't find any method that can help me to get the elements.
Here is how you can process such an array in C#:
var font = Connect.Sys["Process"]("notepad")["Window"]("#32770", "Font", 1);
var a = font["FindAllChildren"]("WndClass", "ComboBox");
object[] elements = (a.UnWrap() as object[]);
for (int i = 0; i < elements.Count(); i++) {
var element = new var(elements[i]);
MessageBox.Show(element["FullName"].UnWrap() as string);
}