Returns the computed WAI-ARIA label of an element.

The command getAccessibleName() will automatically wait for the element to be present (until the specified timeout). If the element is not found, an error is thrown which will cause the test to fail. You can suppress element not found errors by specifying the selector argument as an object and passing the suppressNotFoundErrors = true option.

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


.getAccessibleName(selector, [callback])
.getAccessibleName(using, selector, [callback])


module.exports = {
  demoTest(browser) {
    browser.getAccessibleName('[name="search"]', function(result) {
      this.assert.equal(typeof result, 'object);
      this.assert.equal(result.value, 'search input');

    // with explicit locate strategy
    browser.getAccessibleName('css selector', '[name="search"]', function(result) {
      console.log('getAccessibleName result', result.value);

    // with selector object - see
      selector: '[name="search"]',
      index: 1
    }, function(result) {
      console.log('getAccessibleName result', result.value);

      selector: '[name="search"]',
      timeout: 2000 // overwrite the default timeout (in ms) to check if the element is present
    }, function(result) {
      console.log('getAccessibleName result', result.value);

  demoTestAsync: async function(browser) {
    const result = await browser.getAccessibleName('*[name="search"]');
    console.log('getAccessibleName result', result);


Name Type description

The locator strategy to use. See W3C Webdriver - locator strategies

selector string

The CSS/Xpath selector used to locate the element.

callback function

Callback function which is called with the result value.


Type description
string The computed WAI-ARIA label of element.

W3C WebDriver spec