Skip to content

How to use getShadowRoot command for multiples shadow roots #3267

Answered by egarc12
egarc12 asked this question in Help Needed
Discussion options

You must be logged in to vote

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…

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
1 reply
@egarc12
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by egarc12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
2 participants
Converted from issue

This discussion was converted from issue #3227 on July 04, 2022 08:07.