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)
#
ParameterselemId
: The target element
#
Returns- A
map
having key value pairs of:x
: Position of element on x axis inpixels
y
: Position of element on y axis inpixels
Example:
position = getElementViewportCoordinates(findElement('description', by.desc))# position is {x: 800, y: 2000}