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

Method get_element_rect

seleniumbase/undetected/cdp_driver/tab.py:1552–1567  ·  view source on GitHub ↗
(self, selector, timeout=5)

Source from the content-addressed store, hash-verified

1550 return False
1551
1552 async def get_element_rect(self, selector, timeout=5):
1553 element = await self.select(selector, timeout=timeout)
1554 coordinates = None
1555 if ":contains(" in selector:
1556 position = await element.get_position_async()
1557 x = position.x
1558 y = position.y
1559 width = position.width
1560 height = position.height
1561 coordinates = {"x": x, "y": y, "width": width, "height": height}
1562 else:
1563 coordinates = await self.js_dumps(
1564 """document.querySelector('%s').getBoundingClientRect()"""
1565 % js_utils.escape_quotes_if_needed(re.escape(selector))
1566 )
1567 return coordinates
1568
1569 async def get_window_rect(self):
1570 coordinates = {}

Callers 2

__gui_click_recaptchaMethod · 0.95
get_gui_element_rectMethod · 0.95

Calls 3

selectMethod · 0.95
js_dumpsMethod · 0.95
get_position_asyncMethod · 0.80

Tested by

no test coverage detected