Select the correct answer from the following options and write it down in the comments section:
Which selector can work for shadow DOM elements?
- //**@id="input"]
- //inputt@id="input"]
- inputtid='input']
- //**local-name()='svg']
When dealing with shadow DOM, we typically need to use CSS selectors.
None of the given selectors can directly work with shadow DOM elements. You need to access the shadow DOM through JavaScript and then use the appropriate selector within the shadow root.
Answer: input[id='input']
Explanation: Shadow DOM only supports CSS selectors and does not support XPath.
input[id=’input’]
Thank you everyone who posted their answers and thank you
Congratulations to
Stay tuned to ShiftSync for more exciting content.
No account yet? Create an account
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.