View Source Improve this doc

getLocationInView

Determine an element’s location on the screen once it has been scrolled into view.

Usage

1
browser.getLocationInView(selector);

Parameters

Param Type Details
selector String element with requested position offset

Example

getLocationInView.js
1
2
3
4
5
6
7
8
9
10
11
12
it('should get the location of one or multiple elements in view', function () {
browser.url('http://github.com');
var location = browser.getLocation('.octicon-mark-github');
console.log(location); // outputs: { x: 150, y: 20 }
var xLocation = browser.getLocation('.octicon-mark-github', 'x')
console.log(xLocation); // outputs: 150
var yLocation = browser.getLocation('.octicon-mark-github', 'y')
console.log(yLocation); // outputs: 20
});

Uses