Skip to main content

getElementRect

Retrieves element's coordinates relative to viewport and it's dimensions. Learn more about how it's retrieved in getBoundingClientRect.

getElementRect(elemId)

Parameters#

  • elemId: The target element

Returns#

  • A map having key value pairs of:
    • x: Position of element on x axis in pixels
    • y: Position of element on y axis in pixels
    • width: Width of element in pixels
    • height: Height of element in pixels

Example:

rect = getElementRect(findElement('description', by.desc))# rect is {x: 800, y: 2000, width: 600, height: 200}