Returns a form element current value.

For more info on working with DOM elements in Nightwatch, refer to the Finding & interacting with DOM Elements guide page.

Usage

                    browser.element(selector).getValue()
                

Example

export default {
  demoTest(browser: NightwatchAPI): void {
    const result = browser.element('#login input[type=text]').getValue();
    console.log('Value', result);
  },

  async demoTestAsync(browser: NightwatchAPI): Promise<void> {
    const result = await browser.element('#login input[type=text]').getValue();
    console.log('Value', result);
  }
}

Returns

Type description
ScopedValue<string>

W3C WebDriver spec