Skip to main content

getComputedRole

Overview

Use the getComputedRole command to get the computed WAI-ARIA role of an element.

Usage

await browser.$(selector).getComputedRole();

Usage Examples

it("should demonstrate the getComputedRole command", async ({ browser }) => {
await browser.url("https://www.google.com/ncr");
const elem = await browser.$('*[name="q"]');
console.log(await elem.getComputedRole()); // outputs: "combobox"
});

References

We'd like to give credit to the original WebdriverIO docs article, from which we drew some information while writing our version.