Skip to main content

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']
  • input[id='input']

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.


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']

inputtid=’input’]


Thank you everyone who posted their answers and thank you @sanjaykumar for hosting the webinar.

Congratulations to @Mohamed Alwahedi for winning the contest, we will reach out to you via email shortly to arrange the delivery of your prize, so be on the lookout for an email from us.

Stay tuned to ShiftSync for more exciting content.


Reply