class WebDriver.Options

Provides methods for managing browser and driver state.

new WebDriver.Options(driver)

Parameters
driverwebdriver.WebDriver

The parent driver.

Instance Methods

addCookie(name, value, opt_path, opt_domain, opt_isSecure, opt_expiry)code »

Schedules a command to add a cookie.

Parameters
namestring

The cookie name.

valuestring

The cookie value.

opt_pathstring=

The cookie path.

opt_domainstring=

The cookie domain.

opt_isSecureboolean=

Whether the cookie is secure.

opt_expiry(number|Date)=

When the cookie expires. If specified as a number, should be in milliseconds since midnight, January 1, 1970 UTC.

Returns
webdriver.promise.Promise<undefined>

A promise that will be resolved when the cookie has been added to the page.


deleteAllCookies()code »

Schedules a command to delete all cookies visible to the current page.

Returns
webdriver.promise.Promise<undefined>

A promise that will be resolved when all cookies have been deleted.


deleteCookie(name)code »

Schedules a command to delete the cookie with the given name. This command is a no-op if there is no cookie with the given name visible to the current page.

Parameters
namestring

The name of the cookie to delete.

Returns
webdriver.promise.Promise<undefined>

A promise that will be resolved when the cookie has been deleted.


getCookie(name)code »

Schedules a command to retrieve the cookie with the given name. Returns null if there is no such cookie. The cookie will be returned as a JSON object as described by the WebDriver wire protocol.

Parameters
namestring

The name of the cookie to retrieve.

Returns
webdriver.promise.Promise<?{domain: (string|undefined), expiry: (number|undefined), name: string, path: (string|undefined), secure: (boolean|undefined), value: string}>

A promise that will be resolved with the named cookie, or null if there is no such cookie.


getCookies()code »

Schedules a command to retrieve all cookies visible to the current page. Each cookie will be returned as a JSON object as described by the WebDriver wire protocol.

Returns
webdriver.promise.Promise<Array<{domain: (string|undefined), expiry: (number|undefined), name: string, path: (string|undefined), secure: (boolean|undefined), value: string}>>

A promise that will be resolved with the cookies visible to the current page.


logs()code »

Returns
webdriver.WebDriver.Logs

The interface for managing driver logs.


timeouts()code »

Returns
webdriver.WebDriver.Timeouts

The interface for managing driver timeouts.


window()code »

Returns
webdriver.WebDriver.Window

The interface for managing the current window.

Type Definitions

Options.Cookie{domain: (string|undefined), expiry: (number|undefined), name: string, path: (string|undefined), secure: (boolean|undefined), value: string}

A JSON description of a browser cookie.