Returns the computed WAI-ARIA label of an element.

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

Usage

                    browser.element.find(selector).getAccessibleName()
                
                    browser.element.find(selector).getComputedLabel()
                

Example

export default {
  demoTest(browser: NightwatchAPI): void {
    browser.element('*[name="search"]')
      .getAccessibleName()
      .assert.valueEquals('Country calling code');
  },
  async demoTestAsync(browser: NightwatchAPI): Promise<void> {
    const result: string = await browser.element('*[name="search"]').getAccessibleName();
    console.log('getAccessibleName is ', result);
  }
}

Returns

Type description
ScopedValue<string>

A container with accessible name of an element.

W3C WebDriver spec