← Quiz: Selenium Setup: all 10 questions
Quiz: Selenium Setup · Question 7 of 10
driver.findElement(By.id("missing")) is called and no element matches. What happens?
driver.findElement(By.id("missing")) is called and no element matches. What happens?
- A.It returns null
- B.It returns an empty list
- C.It throws NoSuchElementException
- D.It waits forever
Answer & explanation
Correct answer: It throws NoSuchElementException
Use findElements when absence is a normal, expected result.
Can you get the rest right without peeking?
Take the timed Quiz: Selenium Setup quiz free. Pass it to earn XP and count towards your certificate.
Start the quiz →