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

Quiz: Web Elements · Question 3 of 10

After working inside an iframe, how do you return to the main page?

After working inside an iframe, how do you return to the main page?

  1. A.driver.switchTo().defaultContent()
  2. B.driver.navigate().back()
  3. C.driver.close()
  4. D.driver.switchTo().alert()
Answer & explanation

Correct answer: driver.switchTo().defaultContent()

parentFrame() goes up one level; defaultContent() returns to the top.

Can you get the rest right without peeking?

Take the timed Quiz: Web Elements quiz free. Pass it to earn XP and count towards your certificate.

Start the quiz →