🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← Quiz: Page Object Model: all 10 questions

Quiz: Page Object Model · Question 4 of 10

Why store By locators instead of WebElement fields?

Why store By locators instead of WebElement fields?

  1. A.By objects are faster to type
  2. B.Elements are found fresh each time, avoiding StaleElementReferenceException
  3. C.WebElement can't be stored in a field
  4. D.By works in all browsers but WebElement doesn't
Answer & explanation

Correct answer: Elements are found fresh each time, avoiding StaleElementReferenceException

A stored WebElement can go stale after the page re-renders.

Can you get the rest right without peeking?

Take the timed Quiz: Page Object Model quiz free. Pass it to earn XP and count towards your certificate.

Start the quiz →