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
Name | Type | Description |
shadowSelector | String or Function | Selector 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'
});
Related Commands
References
We'd like to give credit to the original WebdriverIO docs article, from which we drew some information while writing our version.