I’ve read the conversation and still are unsure of the exact element you’re trying to click on. From what I can understand, you want to click (select, but I think a click would suffice in this case) on a list item with different text depending on the requirement.
The following is a generic tutorial, aiming to help you to click on an element when you know that element contains a text, and that this text needs to be changed per requirement
First, in your script where you need to do click on the list item, write the following line:
// Text of the item that you want to click on
def textOfThisItem = 'katalon'
// Notice findTestObject is taking two things: ID of the test object, and a map containing the text you want to click on
WebUI.click(findTestObject('Object Repository/item_has_text_that_needs_to_be_clicked_on', ['textVariable': textOfThisItem]))
At this point, the Test Object does not exist yet, which is why you need to manually create a blank Test Object called item_has_text_that_needs_to_be_clicked_on right under Repository folder.
If you notice in the above code, the findTestObject is accepting the second argument which at this point does not make sense yet. However, intuition should tell you that the passed in value will be used somehow.
The next thing you need to do is to specify the following XPath into the newly created Test Object.
Pay attention to $ since it is a must. The locator itself doesn’t make sense, because ${textVariable} is not a valid XPath syntax. However when this Test Object is used in execution, Katalon will replace ${textVariable} with the value passed in the second argument of findTestObject.
Both ${textVariable} and the value which will actually be used katalon are present in the code above, I believe your intuition would help connect the ideas.
When the line of code above is executed, the final locator would be:
//*[contains(text(), 'katalon)]
which selects an element that contains the text “katalon”. Then this element will be clicked on by WebUi.click.
To confirm this, you can write this after the above piece of code:
println findTestObject('Object Repository/item_has_text_that_needs_to_be_clicked_on,
['textVariable': textOfThisItem]).getSelectorCollection()
.get(SelectorMethod.XPATH);
(Ctrl + Shift + O for auto imports)
which will print //*[contains(text(), 'katalon')] to the console log. I include this because you may want to trial and error the XPath to your element, for which printing our the XPath will be helpful. You can compare the expected XPath against what is printed to see if it maches your expectation.
References
The practice of using $ in your Test Object is called Test Object Parameterization (parameterization means you use variables instead of hard-coded values). Documentation here (Mobile in the title is irrelevant, it is also applicable to Web): https://docs.katalon.com/katalon-studio/docs/parameterize-mobile-test-object-properties.html#in-manual-view