Not able to pass the parameters for the driver elements

Hi ITeam ,
I am passing the a parameter via a driver instance , but its not takeing the values .

List rows = driver.findElements(By.xpath("//*[@id=‘ViewGrid_grdView’]/tbody/tr"))

println rows.size();

List cols = driver.findElements(By.xpath("//*[@id=‘ViewGrid_grdView’]/tbody/tr[1]/td"))

println cols.size();


for (int i = 2; i <= rows.size(); i++) {

WebElement Ele =driver.findElement(By.xpath("//*[@id=‘ViewGrid_grdView’]/tbody/tr[1]/td["+i+"]"));

String colname = Ele.getText().toString();

if (colname == ‘TIN’ || colname == ‘PassportNo’ || colname == ‘LicenseNo’) {

for (int j = 2; j <= cols.size(); j++) {

def Cellval = driver.findElement(By.xpath("//*[@id=‘ViewGrid_grdView’]/tbody/tr[$i]/td[$j]")).getText().toString().trim()





Katalon is not accepting the “i” values when i pass the paramter through drvier instance elements .But when i parametrize in the Object repository i am able to access the element.
kindly do the need full.

def Cellval = driver.findElement(By.xpath("//*[@id='ViewGrid_grdView']/tbody/tr["+i+"]/td["+j+"]")).getText().toString().trim()

def Cellval = driver.findElement(    By.xpath("//*[@id='ViewGrid_grdView']/tbody/tr[${i}]/td[${j}]")).getText().toString().trim()

see to find how you should use ${} and $ syntax

If i provide with ${} then its taking it as Closure statement in Katalon.