getTagName
Get tag name of a DOM-element.
Usage
$(selector).getTagName()
Examples
- Asynchronous Mode
- Synchronous Mode
index.html
<div id="elem">Lorem ipsum</div>
getTagName.js
it('should demonstrate the getTagName command', async () => {
const elem = await $('#elem');
const tagName = await elem.getTagName();
console.log(tagName); // outputs: "div"
})
index.html
<div id="elem">Lorem ipsum</div>
getTagName.js
it('should demonstrate the getTagName command', () => {
const elem = $('#elem');
const tagName = elem.getTagName();
console.log(tagName); // outputs: "div"
})
caution
Synchronous Mode will depcrecated with Node.js v16. With an update to the underlying Chromium version it became technically impossible to provide the same synchronous behavior. We recommend to start transition to asynchronous command execution. For more information, see our RFC.