parent

The command to get the parent of the current element.

Syntax

Element.parent() -> Element

Usage

correct usage
py.get("li").parent()

---or--- # store in a variable

element = py.get("li").parent()

---or--- # chain an Element command

py.get("li").parent().click()

---or--- # even go up the DOM tree

grand_parent = py.get("li").parent().parent()

Arguments

  • None

Yields

  • Element - The parent Element

Last updated