Skip to main content

shadow$

Overview

Use the shadow$ command to access an element within the ShadowRoot of a given element.

Usage

await browser.$(selector).shadow$(shadowSelector);

Command Parameters

NameTypeDescription
shadowSelectorString or FunctionSelector or JS function to get a specific element.

Usage Examples

it("should return an element inside a ShadowRoot", async ({ browser }) => {
const innerEl = await browser.$(".input").shadow$("#innerEl");
console.log(await innerEl.getValue()); // outputs: 'test123'
});

References

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