.getShadowRoot() Suggest edits
Since: 3.0.0Returns the shadowRoot
read-only property which represents the shadow root hosted by the element. This can further be used to retrieve elements part of the shadow root element.
For more info on working with DOM elements in Nightwatch, refer to the Finding & interacting with DOM Elements guide page.
Usage
Example
export default {
demoTest(browser: NightwatchAPI): void {
browser.element('#login').getShadowRoot().then(result => {
console.log('shadowRootEl', result);
});
},
async demoTestAsync(browser: NightwatchAPI): Promise<void> {
const result = await browser.element('#login').getShadowRoot();
console.log('shadowRootEl', result);
}
}
Returns
Type | description |
---|---|
ScopedWebElement |