← Quiz: Locators: all 10 questions
Quiz: Locators · Question 9 of 10
Why is By.className often a poor choice?
Why is By.className often a poor choice?
- A.It is slower than XPath
- B.Classes are usually shared by many elements, so it is rarely unique
- C.It does not work in Chrome
- D.It can only find buttons
Answer & explanation
Correct answer: Classes are usually shared by many elements, so it is rarely unique
Prefer id, name, a data-testid attribute or a precise CSS selector.
Can you get the rest right without peeking?
Take the timed Quiz: Locators quiz free. Pass it to earn XP and count towards your certificate.
Start the quiz →