How to use getShadowRoot command for multiples shadow roots #3267
-
Hello everyone Does anyone have any idea how to use the getShadowRoot command when shadowRoot elements exist inside another shadowRoot element? For example the following HTML: How could I get to the element named iron-query-params? I am using version 2.1.7 of Nightwatch |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
@egarc12 could you please try running this :
|
Beta Was this translation helpful? Give feedback.
-
I found the error, it seems when I initialize my custom command in the following way the command does not work as expected
But when I initialize it in the following way it works correctly
This is the issue: #3000 This is my custom command to get an element in nested shadow roots:
|
Beta Was this translation helpful? Give feedback.
I found the error, it seems when I initialize my custom command in the following way the command does not work as expected
module.exports.command = async function (roots, selectors, callback) { ...
But when I initialize it in the following way it works correctly
module.exports = class CustomCommand { async command(roots, selectors, callback) { ...
This is the issue: #3000
This is my custom command to get an element in nested shadow roots:
module.exports = class CustomCommand { async command(roots, selectors, callback) { if (!Array.isArray(selectors)){ selectors = [selectors]; } if (!Array.isArray(roots)){ roots = [roots]; } var shadowElement; shadowElement = await browser.getShadowRoot(ro…