MCPcopy Create free account
hub / github.com/SeleniumHQ/selenium / location

Method location

py/selenium/webdriver/remote/webelement.py:363–374  ·  view source on GitHub ↗

Get the location of the element in the renderable canvas. Returns: The x and y coordinates of the element. Example: loc = element.location

(self)

Source from the content-addressed store, hash-verified

361
362 @property
363 def location(self) -> dict:
364 """Get the location of the element in the renderable canvas.
365
366 Returns:
367 The x and y coordinates of the element.
368
369 Example:
370 loc = element.location
371 """
372 old_loc = self._execute(Command.GET_ELEMENT_RECT)["value"]
373 new_loc = {"x": round(old_loc["x"]), "y": round(old_loc["y"])}
374 return new_loc
375
376 @property
377 def rect(self) -> dict:

Callers

nothing calls this directly

Calls 1

_executeMethod · 0.95

Tested by

no test coverage detected