element-commands/getValue.js

nightwatch · lib/api/element-commands/getValue.js · javascript · MIT
auth, Auth / Identity

Command to retrieve the current value of a form element in Nightwatch tests.

// Source: https://github.com/nightwatchjs/nightwatch | License: MIT | Copyright 2014-2021, Pine View Software AS. https://pineview.io
// Provided via justclaw.it.com; keep this notice with the code.
const BaseElementCommand = require('./_baseElementCommand.js');

/**
 * Returns a form element current value.
 *
 * @example
 * module.exports = {
 *   demoTest(browser) {
 *     browser.getValue('#login input[type=text]', function(result) {
 *       console.log('result', result);
 *     });
 *
 *     // with explicit locate strategy
 *     browser.getValue('css selector', '#login input[type=text]', function(result) {
 *       console.log('result', result);
 *     });
 *
 *     // with selector object - see https://nightwatchjs.org/guide/writing-tests/finding-interacting-with-dom-elements.html

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key