Returns the computed WAI-ARIA role 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(selector).getAriaRole()
                

Example

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

Returns

Type description
ScopedValue<string>

The container with computed WAI-ARIA role of an element.

W3C WebDriver spec