← Quiz: Web Elements: all 10 questions
Quiz: Web Elements · Question 8 of 10
A link opens an invoice in a new tab. How do you work in that tab?
A link opens an invoice in a new tab. How do you work in that tab?
- A.Selenium switches automatically
- B.Get the window handles and call driver.switchTo().window(handle) for the new one
- C.Use switchTo().frame()
- D.Open a new WebDriver
Answer & explanation
Correct answer: Get the window handles and call driver.switchTo().window(handle) for the new one
Save the main handle first so you can switch back afterwards.
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 →