Forum Discussion
shankar_r
9 years agoCommunity Hero
Basically, you want to select a row based on the table column value.
for this, you follow below steps:
1. Loop thru rows and columns of JSwing table.
2. When cell value matches with your expected then using the Row id you can select a particular row.
This is having some basic operations with JSwing table https://support.smartbear.com/testcomplete/docs/app-objects/specific-tasks/grids/jtable/selecting-cells.html
In your scenario, you want to select a row based on the customer name then you use following code.
I'm not a python script-er.
in Javascript,
var objTable = <your swing table object>
var expValue = <your expected customer name>
for(var i = 0 ; i < objTable.wRowCount ; i++)
{
for(var j=0 ; i <objTable.wColumnCount ; j++)
{
if( objTable.wValue(i,j) == expValue)
{
objTable.ClickCell(i,j);
break;
}
}
}
//if you know column name then you use
for(var i = 0 ; i < objTable.wRowCount ; i++)
{
if( objTable.wValue(i,<your coulmn name>) == expValue)
{
objTable.ClickCell(i,<your coulmn name>);
break;
}
}let me know if this is works for you