Skip to main content
sanjaykumar
Specialist
June 26, 2024

Question for (Mastering Web Automation: Strategies for Complex Challenges by SelectorsHub Creator Sanjay Kumar) Webinar attendants

  • June 26, 2024
  • 5 replies
  • 175 views

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"]
  • //input[@id="input"]
  • input[id='input']
  • //*[local-name()='svg']

5 replies

Dhrumil812
Ensign
June 26, 2024
  • input[id='input']

When dealing with shadow DOM, we typically need to use CSS selectors.

Dhrumil
sabarish
Ensign
June 26, 2024

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.

Space Cadet
June 26, 2024

Answer: input[id='input']

Explanation: Shadow DOM only supports CSS selectors and does not support XPath.

Ensign
June 26, 2024

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"]
  • //input[@id="input"]
  • input[id='input']
  • //*[local-name()='svg']

input[id=’input’]

Mustafa
Technical Community Manager
July 1, 2024

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.

Only in Death does Duty End