Skip to main content

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

  • 26 June 2024
  • 5 replies
  • 112 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"]
  • //inputt@id="input"]
  • inputtid='input']
  • //**local-name()='svg']

5 replies

  • input[id='input']

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

Userlevel 1

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

input[id=’input’]

Userlevel 5
Badge +5

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