Hoping someone can help with this.
I have a table of users with 9 columns (Username | First Name | Last Name | Employee Number | Active Date | Inactive Date | Status | Delete | Reset Password.
I need to find the row that contains a certain username and then update the XPath of the delete button object so that I can click the correct one.
I match the Object User on:
tag = a
text contains UserName
I can’t match on href or ID as these are dynamic (i.e. /Account/Delete/0a99cb8e-8891-41d9-8e65-c082313f6c2c)
Currently this object would also match the Xpath:
//*[@id="grid"]/table/tbody/tr[249]/td[1]/a
However the tr[249] value will change depending on how many other users are in the table so I can’t rely on it.
I would like to extract the tr value from the XPath of the found object and save it in a variable so I can pass it into the Xpath of the Delete User object.
Currently the manual Xpath is:
//*[@id="grid"]/table/tbody/tr[249]/td[8]/a
which I guess I can change like so:
user_row = 0
TestObject to = findTestObject('Page_Users/a_Edit User', [('text') : GlobalVariable.G_User])
to.findPropertyValue('xpath')."a_Delete User" = WebUI.modifyObjectProperty(to, 'xpath', 'equals', ('//*[@id="grid"]/table/tbody/tr[' +
user_row) + ']/td[8]/a', false)
Just struggling with finding and extracting the correct value so I can assign to user_row.