UNPKG

nightwatch

Version:

Easy to use Node.js based end-to-end testing solution for web applications using the W3C WebDriver API.

33 lines (29 loc) 988 B
const ClientCommand = require('./_base-command.js'); /** * Retrieve all cookies visible to the current page. The cookies are returned as an array of cookie JSON object, as defined [here](https://github.com/SeleniumHQ/selenium/wiki/JsonWireProtocol#cookie-json-object). * * Uses `cookie` protocol command. * * @example * this.demoTest = function(browser) { * browser.getCookies(function callback(result) { * this.assert.equal(result.value.length, 1); * this.assert.equal(result.value[0].name, 'test_cookie'); * }); * } * * * @method getCookies * @param {function} callback The callback function which will receive the response as an argument. * @syntax .getCookies(callback) * @api protocol.cookies * @see cookie * @returns {Array.<object>} A list of cookies. * @deprecated In favour of `.cookies.getAll()`. */ class GetCookies extends ClientCommand { performAction(callback) { this.api.cookie('GET', callback); } } module.exports = GetCookies;