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