getLocation
Determine an element’s location on the page. The point (0, 0) refers to the upper-left corner of the page.
Usage
browser.getLocation(property)
Parameters
Param | Type | Details |
---|---|---|
property optional | param | can be "x" or "y" to get a result value directly for easier assertions |
Example
it('should demonstrate the getLocation function', 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
});