Namespace: webdriver
View Source

# class WebDriver.Window

An interface for managing the current window.

## new WebDriver.Window(driver)

Parameters

driver`webdriver.WebDriver`

  The parent driver.

## Instance Methods

### getPosition()code »

Retrieves the window's current position, relative to the top left corner of the screen.

Returns

`webdriver.promise.Promise<{x: number, y: number}>`

  A promise that will be resolved with the window's position in the form of a {x:number, y:number} object literal.

### getSize()code »

Retrieves the window's current size.

Returns

`webdriver.promise.Promise<{height: number, width: number}>`

  A promise that will be resolved with the window's size in the form of a {width:number, height:number} object literal.

### maximize()code »

Maximizes the current window.

Returns

`webdriver.promise.Promise<undefined>`

  A promise that will be resolved when the command has completed.

### setPosition(x, y)code »

Repositions the current window.

Parameters

x`number`

  The desired horizontal position, relative to the left side of the screen.

y`number`

  The desired vertical position, relative to the top of the of the screen.

Returns

`webdriver.promise.Promise<undefined>`

  A promise that will be resolved when the command has completed.

### setSize(width, height)code »

Resizes the current window.

Parameters

width`number`

  The desired window width.

height`number`

  The desired window height.

Returns

`webdriver.promise.Promise<undefined>`

  A promise that will be resolved when the command has completed.