shadow$
Access an element inside a given element's shadowRoot. If you are working
with lots of nested shadow roots, an alternative approach to shadow$
is
to use the deep selector.
Usage
$(selector).shadow$(selector)
Parameters
Name | Type | Details |
---|---|---|
selector | String , Function | selector or JS Function to fetch a certain element |
Example
- Asynchronous Mode
- Synchronous Mode
shadow$$.js
it('should return an element inside a shadowRoot', async () => {
const innerEl = await $('.input').shadow$('#innerEl');
console.log(await innerEl.getValue()); // outputs: 'test123'
});
shadow$$.js
it('should return an element inside a shadowRoot', () => {
const innerEl = $('.input').shadow$('#innerEl');
console.log(innerEl.getValue()); // outputs: 'test123'
});
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.