Sends some text to an element. Can be used to set the value of a form element or to send a sequence of key strokes to an element. Any UTF-8 character may be specified.

update also clears the existing value of the element by calling the clear() beforehand.

An object map with available keys and their respective UTF-8 characters, as defined on W3C WebDriver draft spec, is loaded onto the main Nightwatch instance as browser.Keys.

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

Usage

                    browser.element(selector).update(characters, ...keys)
                

Example

export default {
  demoTest(browser: NightwatchAPI): void {
    browser.element('input[type=text]').update('nightwatch', browser.Keys.ENTER);
  },

  async demoTestAsync(browser: NightwatchAPI): Promise<void> {
    await browser.element('input[type=text]').update('nightwatch', browser.Keys.ENTER);
  }
}

Parameters

Name Type description
keys string

Returns

Type description
ScopedWebElement

W3C WebDriver spec