🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← All topics

Quiz: Locators: questions with answers

10 questions, each with the answer and a short explanation.

Take the timed quiz + get a certificate →
  1. Q1. Which CSS selector finds an input whose type is email?
  2. Q2. Which XPath finds the marks cell next to the cell containing "Neha"?
  3. Q3. What can XPath do that CSS selectors cannot?
  4. Q4. Why avoid absolute XPath like /html/body/div[2]/form/input[1]?
  5. Q5. What is the most robust locator you can ask developers for?
  6. Q6. How many locator strategies does Selenium's By class offer?
  7. Q7. Which CSS selector finds an input whose name starts with "pass"?
  8. Q8. Which XPath goes from the cell containing "Neha" up to its whole table row?
  9. Q9. Why is By.className often a poor choice?
  10. Q10. What does the XPath (//tr)[2] find?