Dave_Gorman
12 years agoOccasional Contributor
Click on a cell when there are multiple tables
Can anyone explain how this might work? I'm using JavaScript, TestComplete, Web testing, the cells don't have a unique idStr or ObjectIdentifier. I already use this function to click on a table cell when there is only one table. I am very new to programming so "Smart "bear with me haha:
function ClickTableCell(rowIndex, columnIndex) {
var tableCellObject, propertyNames, propertyValues;
WaitForPage();
propertyNames = new Array("RowIndex", "ColumnIndex", "FullName", "ObjectType");
propertyValues = new Array(rowIndex, columnIndex, "*Table(dataTbl_hdn)*", "Cell");
//search for objects with matching properties
Sys.Browser("iexplore").Refresh();
tableCellObject = Sys.Browser("iexplore").FindAll(propertyNames, propertyValues, '20000', 'TRUE');
tableCellObject = (new VBArray(tableCellObject)).toArray();
//click on first matching object
if (tableCellObject.length > 0) {
tableCellObject[0].Click();
} else {
LogErrorMessage("ClickTableCell: Unable to find table cell");
}
}
Thanks,
Dave
function ClickTableCell(rowIndex, columnIndex) {
var tableCellObject, propertyNames, propertyValues;
WaitForPage();
propertyNames = new Array("RowIndex", "ColumnIndex", "FullName", "ObjectType");
propertyValues = new Array(rowIndex, columnIndex, "*Table(dataTbl_hdn)*", "Cell");
//search for objects with matching properties
Sys.Browser("iexplore").Refresh();
tableCellObject = Sys.Browser("iexplore").FindAll(propertyNames, propertyValues, '20000', 'TRUE');
tableCellObject = (new VBArray(tableCellObject)).toArray();
//click on first matching object
if (tableCellObject.length > 0) {
tableCellObject[0].Click();
} else {
LogErrorMessage("ClickTableCell: Unable to find table cell");
}
}
Thanks,
Dave