java – Selenium webdriver | driver().switchTo().defaultContent() method is not switching the control back to parent window from multiple child windows

There are two similar methods that can be used while switching to parent frames, but there is a slight difference between them.

driver.switchTo().defaultContent()
driver.switchTo().parentFrame()

E.g.: You have three frames i1,i2,i3 and you are on frame i3,
when you use driver.switchTo.defaultContent(), it will take you to i1, whereas with
driver.switchTo.parentFrame() control will switch to i2 i.e. immediate parent frame (parent frame of the current frame).

Read more here: Source link