Query for an element's tag name.

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

Usage

                    browser.element(selector).getTagName()
                

Example

export default {
  demoTest(browser: NightwatchAPI): void {
    const result = browser.element('#login').getTagName();
    console.log('element tag:', result);
  },

  async demoTestAsync(browser: NightwatchAPI): Promise<void> {
    const result = await browser.element('#login').getTagName();
    console.log('element tag:', result);
  }
}

Returns

Type description
ScopedValue<string>

W3C WebDriver spec