There are two similar methods that can be used while switching to parent frames, but there is a slight difference between them.
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