getLocation

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

Usage

1
client.getLocation(selector).then(callback);

Parameters

Param Type Details
selector String element with requested position offset

Example

getLocation.js
1
2
3
4
5
6
7
8
9
10
11
client
.url('http://github.com')
.getLocation('.header-logo-wordmark').then(location) {
console.log(location); // outputs: { x: 100, y: 200 }
})
.getLocation('.header-logo-wordmark', 'x').then(location) {
console.log(location); // outputs: 100
})
.getLocation('.header-logo-wordmark', 'y').then(location) {
console.log(location); // outputs: 200
});

Uses