How can we move to the parent of an element using XPath?

How can we move to the parent of an element using XPath?

Hey Helen

In order to move the parent of an element using XPath, you can use /.. after the XPath expression of the child element.

For example, the locator //div[@id=”childId”]/.. will move to the parent of the div element with id value as childId.