getComputedRole
Get the computed WAI-ARIA label of an element.
Usage
$(selector).getComputedRole()
Example
- Asynchronous Mode
- Synchronous Mode
getComputedRole.js
it('should demonstrate the getComputedRole command', async () => {
await browser.url('https://www.google.com/ncr')
const elem = await $('*[name="q"]');
console.log(await elem.getComputedRole()); // outputs: "combobox"
})
getComputedRole.js
it('should demonstrate the getComputedRole command', () => {
browser.url('https://www.google.com/ncr')
const elem = $('*[name="q"]');
console.log(elem.getComputedRole()); // outputs: "combobox"
})
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.