getLocation

Determine an element’s location on the page. The point (0, 0) refers to the upper-left corner of the page.

Usage#
$(selector).getLocation(prop)
Parameters#
NameTypeDetails
propStringcan be "x" or "y" to get a result value directly for easier assertions
Example#
getLocation.js
it('should demonstrate the getLocation function', () => {
browser.url('http://github.com');
const logo = $('.octicon-mark-github')
const location = logo.getLocation();
console.log(location); // outputs: { x: 150, y: 20 }
const xLocation = logo.getLocation('x')
console.log(xLocation); // outputs: 150
const yLocation = logo.getLocation('.octicon-mark-github', 'y')
console.log(yLocation); // outputs: 20
});