mikej411
10 years agoOccasional Contributor
How to click on specific cell and row number in grid using passed parameter
I need to create a function to click on an Infragistics WebDataGrid using TestComplete.
Simply clicking on the grid in my main test is easy:
page.grid.cell(3, 1).Click();
However I want to convert this process into a function, and I am having trouble passing the row and cell numbers in parameters.
My function:
function ClickGrid(cellandrow)
{
page.grid.cell(cellandrow).Click(); }
My code that calls the functon:
ClickGrid("3, 1");
When I run the test, it says "Unable to find cell(3, 1)". So the parameter is being passed correctly, but I just dont think the Click method likes it being sent as a String. I tried to split the cell and row into 2 parameters, then convert them to integers with the following but it resulted in the same "Unable to find cell(3, 1)"
function ClickGrid(cell, row)
{
aqConvert.StrToInt(cell) aqConvert.StrToInt(row);
page.grid.cell(cell + ", " + row).Click(); }
What am I missing here?
Try this:
page.grid.cell(cell,row).Click();