I used Relative xpath helper chrome extension to find the relative xpath between two web items. The first has identifiable text, the latter is an empty box in a grid that needs to be completed in the row of the identifiable text. The grid is dynamic. I want to use the text item as the search point to then find the empty box and click on the box, so I want to program Katalon to find the box using the text item. I can’t figure out what to tell the program to look for because I don’t know what the successive /…/…/ means.
Ideas?
Item 1 xpath - Empty Box
//DIV[@class=‘slick-cell l5 r5 hasEditor selected row-selected row-selected-top row-selected-bottom’]
Item 2 xpath - Text Item in row used to find empty box
//SPAN[@title=‘1020Q, 02-Planning, 60331 - Miscellaneous Expense, ***’][text()=‘1020Q, 02-Planning, 60331 - Miscellaneous Expense, ***’]
Relative xpath
//SPAN[@title=‘1020Q, 02-Planning, 60331 - Miscellaneous Expense, ***’][text()=‘1020Q, 02-Planning, 60331 - Miscellaneous Expense, ***’]/…/…/…/…/…/…//DIV[@class=‘slick-cell l5 r5 hasEditor selected row-selected row-selected-top row-selected-bottom’]
Code in Katalon to Locate Object
def rawXpath = ‘’’(.//*[normalize-space(text()) and normalize-space(.)=‘1020Q, 02-Planning, 60331 - Miscellaneous Expense, ***’])[1]/following::div[]’’’
TestObject dynamicObject = new TestObject(‘dynamicObject’).addProperty(‘xpath’, ConditionType.EQUALS, rawXpath, true)
blnobjFound = WebUI.verifyElementPresent(dynamicObject, 5, FailureHandling.OPTIONAL)
println(blnobjFound)
WebUI.click(dynamicObject)