Skip to main content

getElementViewportCoordinates

Scrolls the given element into viewport before getting it's position relative to viewport. Learn more about how it's retrieved in getBoundingClientRect.

getElementViewportCoordinates(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

Example:

position = getElementViewportCoordinates(findElement('description', by.desc))# position is {x: 800, y: 2000}