How to obtain parent of an element at runtime and perform user actions on the parent

Does Katalon studio allow to obtain parent of an element on the UI at runtime and then perform user actions on the parent? I have tried using the getParentObject() method and the .parentObject property with no luck.

Thanks!

One idea:

You need to be familiar with the JavaScript DOM API, parentNode property. See

Using WebUI.executeJavaScript(String) keyword, you can send any JavaScript code from your Test Case into the target browser and let it run it inside the web page currently opened.

Alternatively, you can use ::parent axis of XPath expression.

If you can identify a HTML element by an XPath expression

//*/div[@id="foo"]

then the parent node of the element can be located by an XPath expression

//*/div[@id="foo"]/::parent:*

You would be able to create Test Objects for those XPath expressions manually, and use them in your Test Cases.

Don’t expect the Spy and Recorder tools to generate such Test Objects with XPath with ::parent axes. These tools don’t know what the XPath Axes are.