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

Method get_gui_element_center

seleniumbase/core/sb_cdp.py:1655–1664  ·  view source on GitHub ↗

(Coordinates are relative to the screen. Not the window.)

(self, selector, timeout=None)

Source from the content-addressed store, hash-verified

1653 return ({"height": e_height, "width": e_width, "x": x, "y": y})
1654
1655 def get_gui_element_center(self, selector, timeout=None):
1656 """(Coordinates are relative to the screen. Not the window.)"""
1657 if not timeout:
1658 timeout = settings.SMALL_TIMEOUT
1659 element_rect = self.get_gui_element_rect(selector, timeout=timeout)
1660 e_width = element_rect["width"]
1661 e_height = element_rect["height"]
1662 e_x = element_rect["x"]
1663 e_y = element_rect["y"]
1664 return ((e_x + e_width / 2.0) + 0.5, (e_y + e_height / 2.0) + 0.5)
1665
1666 def get_document(self):
1667 return self.loop.run_until_complete(self.page.get_document())

Callers 7

gui_click_elementMethod · 0.95
gui_click_with_offsetMethod · 0.95
gui_drag_and_dropMethod · 0.95
gui_click_and_holdMethod · 0.95
gui_hover_elementMethod · 0.95

Calls 1

get_gui_element_rectMethod · 0.95

Tested by

no test coverage detected