MCPcopy Create free account
hub / github.com/seleniumbase/SeleniumBase / get_parent

Method get_parent

seleniumbase/fixtures/base_case.py:2117–2128  ·  view source on GitHub ↗

Returns the parent element. If element is a string, then finds element first via selector.

(self, element, by="css selector", timeout=None)

Source from the content-addressed store, hash-verified

2115 self.set_attributes('[target="_blank"]', "target", "_self")
2116
2117 def get_parent(self, element, by="css selector", timeout=None):
2118 """Returns the parent element.
2119 If element is a string, then finds element first via selector."""
2120 if self.__is_cdp_swap_needed():
2121 return self.cdp.get_parent(element)
2122 if isinstance(element, str):
2123 if not timeout:
2124 timeout = settings.LARGE_TIMEOUT
2125 element = self.wait_for_element_present(
2126 element, by=by, timeout=timeout
2127 )
2128 return element.find_element(by="xpath", value="..")
2129
2130 def get_property(
2131 self, selector, property, by="css selector", timeout=None

Callers

nothing calls this directly

Calls 3

__is_cdp_swap_neededMethod · 0.95
find_elementMethod · 0.45

Tested by

no test coverage detected