Check if element is inside another specific element

I would like to check if the text ‘Alpine White’ is related to the type code ‘P0751’.
After looking up some maybe similar problems I still couldnt figure it out, any help really appreciated!

kat1.PNG

you can check for element present/visible and element xpath will be:
//span[text()=‘P0751’]//h4[contains(text(),‘Alpine white.’)]
ofcourse those values can be set as variables and set during script execution
https://docs.katalon.com/display/KD/Manage+Test+Object#ManageTestObject-ParameterizingTestObject

Thank you for the help, that was exactly what I was looking for!

One last thing regarding the parameterizing:
TestObject to = findTestObject(‘bm/color/colorcode’, [’(class)’ : ‘{P0751}’])

This testobject however cant be found, because it still uses the old value, and not the one I tired to set during the execution.
(Finding web element with id: ‘Object Repository/bm/color/colorcode’ located by ‘By.xpath: //*[@class = ‘${class}’]’)

Same happens when i declare class without a pre set value

lukas krombholz said:

Thank you for the help, that was exactly what I was looking for!

One last thing regarding the parameterizing:
TestObject to = findTestObject(‘bm/color/colorcode’, [’(class)’ : ‘{P0751}’])

This testobject however cant be found, because it still uses the old value, and not the one I tired to set during the execution.
(Finding web element with id: ‘Object Repository/bm/color/colorcode’ located by ‘By.xpath: //*[@class = ‘${class}’]’)

Same happens when i declare class without a pre set value

It works with this for now:

TestObject to = findTestObject(‘bm/color/colorcode’)

to.addProperty(‘class’, ConditionType.EQUALS, attribute, true)

I will see how it behaves with addProperty() when the same testobject is used multiple times int he same run, with different values

1 Like