modifyObjectProperty doesn't work

I have a table with many rows where I’m trying to find item created by my previous script. I have an object which is pointing on first row of table. I would like to modify this object xpath that it will check each row until it will find row created by me.
I have such script which is always pointing to row 1. What is wrong in this code?

def expenseReport = WebUI.getText(findTestObject(‘ExpensePage/Approvals/td_SubmittedExpense’))

int i = 1

while (expenseReport != (GlobalVariable.ExpenseReportName)){


new_td_SubmittedExpense = WebUI.modifyObjectProperty(findTestObject(‘ExpensePage/Approvals/td_SubmittedExpense’), ‘xpath’, ‘equals’,

'//*[@alllines"]/div//div[${i}]/table/tbody/tr/td[2]', false)

expenseReport = WebUI.getText(findTestObject(‘ExpensePage/Approvals/td_SubmittedExpense’))


to use groovy substitution whole text must be in double-quotes:

println 'not working substitution ${i}'
println "working substitution ${i}"

Thanks Andrej but I don’t get it, could you show me on example of my code?

change string that defines your xpath and put it to “”

"//[(at)attr=‘something here that forum screwed’]/div//div[${i}]/table/tbody/tr/td[2]"
or use
[(at)attr=“something here that forum screwed”]/div//div[’+i+’]/table/tbody/tr/td[2]’

1 Like

Thanks Andrej!