I tried to parameterize my testobjects like it’s described here:
https://docs.katalon.com/display/KD/Manage+Test+Object#ManageTestObject-ParameterizingTestObject
It works fine for to get //*[@class = attribute] with the code below
TestObject to = findTestObject('bm/color/colorcode')
to.addProperty('class', ConditionType.EQUALS, attribute, true)
However it does not work with xpath for me so far…
The xpath I want to get: //*[@class = ‘P0751’]//h4[contains(text(),‘Alpine white.’)] by this:
TestObject to = findTestObject('bm/color/colorname')
String prop = "//*[@class = '"+detail+"']//h4[contains(text(),'"+attribute+"')]"
to.addProperty('xpath', ConditionType.EQUALS, prop, true)
The xpath is correct! If I print the String prop and use it as the xpath of colorname manually, it works perfectly.
My only guess is that the String is somehow not accepted as a xpath value because handing it over manually into the testobject works, but using the addProperty() method ends in this:
Finding web element with id: ‘Object Repository/bm/color/colorname’ located by 'By.xpath: ’ in ‘30’ second(s)
Where there is no xpath shown, like it didn’t accept it and that for kept it empty?
I appreciate any help!