Showing results for 
Search instead for 
Did you mean: 

Find an object with a variable

Occasional Contributor

Find an object with a variable

Do you ever need to find a row or cell in a table?


Findobject could do it for you but you have to hardcode a value from a property such as contentText. I have found a way to add a variable to find object.


  1. Make a new keyword test
  2. Perform find object and add a value for content text
  3. Right click on the keyword test to create a script. This is an easy way to get the mapping correct.
  4. In the script add an input variable to the function call
  5. Change the hardcoded value in quotes to the new variable
  6. Now drag the script into a keyword test and add the input value.


You can now find any value in the Table.


function Find_an_object(passed_in_value) {
//Simulates a left-button single click in a window or control as specified (relative position, shift keys).
var PropNames, PropValues, passed_in_value, row_num;
PropNames = new Array("ContentText");
PropValues = new Array(passed_in_value);, PropValues, 1000, true).Click();
row_num =, PropValues, 1000, true).RowIndex;
return (row_num)

Happy Testing


Community Manager

Re: Find an object with a variable

Great advice! Thank you for sharing Lori.

Sonya Mihaljova
Community and Education Specialist

Learn SmartBear products in a fun and easy way and prove your knowledge!
>>Participate in the TechCorner Challenge today
New Here?
Join us and watch the welcome video:
Join TechCorner Challenge!
Want a fun and easy way to learn TestComplete? Try solving weekly TechCorner challenges and get into the Leaderboard!

Challenge Status

Changing options from outside of TestComplete


How to execute remote test and obtain results via Test Runner REST API


Comparing content of HTML table with Excel file data


Compare HTML table with Excel file and correct data in the file

Top Kudoed Authors