# getSize

Get the width and height for an DOM-element.

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

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

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

| Name                   | Type     | Details                                           |
| ---------------------- | -------- | ------------------------------------------------- |
| `prop`<br />*optional* | `String` | size to receive \[optional] ("width" or "height") |

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

getSize.js

```
it('should demonstrate the getSize command', async () => {
    await browser.url('http://github.com')
    const logo = await $('.octicon-mark-github')

    const size = await logo.getSize()
    console.log(size) // outputs: { width: 32, height: 32 }

    const width = await logo.getSize('width')
    console.log(width) // outputs: 32

    const height = await logo.getSize('height')
    console.log(height) // outputs: 32
})
```

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

* **\<Object|Number>** **`return`:** requested element size (`{ width: <Number>, height: <Number> }`) or actual width/height as number if prop param is given
