# getLocation

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

## Usage[​](#usage "Direct link to Usage")

```
await $(selector).getLocation(prop)
```

## Parameters[​](#parameters "Direct link to Parameters")

| Name   | Type     | Details                                                                |
| ------ | -------- | ---------------------------------------------------------------------- |
| `prop` | `string` | can be "x" or "y" to get a result value directly for easier assertions |

## Example[​](#example "Direct link to Example")

getLocation.js

```
it('should demonstrate the getLocation function', async () => {
    await browser.url('http://github.com');
    const logo = await $('.octicon-mark-github')
    const location = await logo.getLocation();
    console.log(location); // outputs: { x: 150, y: 20 }

    const xLocation = await logo.getLocation('x')
    console.log(xLocation); // outputs: 150

    const yLocation = await logo.getLocation('y')
    console.log(yLocation); // outputs: 20
});
```

## Returns[​](#returns "Direct link to Returns")

* **\<Object|Number>** **`return`:** The X and Y coordinates for the element on the page `{x:number, y:number}`
