pcherng
13 years agoOccasional Contributor
Problem with Find method returning objects with the wrong indexes
I am writing a connected application with C# in VS2010 and TestComplete v8.6 for testing an application using lots of Java Swing components. I was trying to find a particular table using the Find method and click on the last row of the table using the ClickCell method. I also had the program print the FullName of the found object to the console.
var table= Sys["Find"]("Name", "[\"SwingObject\"](\"GenericTable\", \"\", 0)", 20000, true);
string test = table["FullName"];
Console.WriteLine(test);
int last_row_index = table["getRowCount"]() - 1;
table["ClickCell"](last_row_index, 0);
However, I get an error when it tries to click on the cell because the object apparently doesn't exist. Upon checking the console output, I see that it did indeed find the object I intended to find, but when I compare the FullName that is printed on the console against the FullName that is displayed using Object Spy/Object Browser, I notice that several of the index parameters for SwingObject have discrepancies. In particular, all of the index parameters that are printed out to console are 0, which is not the case when looking in the Object Browser.
I further tested by simply copying and pasting the FullName from ObjectBrowser into my code for the assignment of var table, and the code worked fine. However, this is not an ideal solution because the index parameters are not reliable as they can change from run to run and I do not wish to repeatedly change my code just to run this task.
Am I doing something wrong? Please advise.
Thanks,
-Paul Cherng
var table= Sys["Find"]("Name", "[\"SwingObject\"](\"GenericTable\", \"\", 0)", 20000, true);
string test = table["FullName"];
Console.WriteLine(test);
int last_row_index = table["getRowCount"]() - 1;
table["ClickCell"](last_row_index, 0);
However, I get an error when it tries to click on the cell because the object apparently doesn't exist. Upon checking the console output, I see that it did indeed find the object I intended to find, but when I compare the FullName that is printed on the console against the FullName that is displayed using Object Spy/Object Browser, I notice that several of the index parameters for SwingObject have discrepancies. In particular, all of the index parameters that are printed out to console are 0, which is not the case when looking in the Object Browser.
I further tested by simply copying and pasting the FullName from ObjectBrowser into my code for the assignment of var table, and the code worked fine. However, this is not an ideal solution because the index parameters are not reliable as they can change from run to run and I do not wish to repeatedly change my code just to run this task.
Am I doing something wrong? Please advise.
Thanks,
-Paul Cherng