Types a key sequence on the DOM element. Can be used to send a sequence of key strokes to an element. Any UTF-8 character may be specified.

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).sendKeys(...keys)
                

Example

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

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

Parameters

Name Type description
keys string

Returns

Type description
ScopedWebElement

See also

W3C WebDriver spec