How to Switch From Inner iFrame to the Parent iFrame?

Timothy Joseph | January 24, 2022

How to Switch From Inner iframe to the Parent iframe?

Following are the ways with which you can handle iFrames:

  1. SwitchTo().frame(int frameNumber): This works based on the frame index.
  2. SwitchTo().frame(string frameName): This works based on the name of the frame.
  3. SwitchTo().frame(WebElement frameElement): This works based on frame webElement.

Now if you want to switch back to the parent frame, you can use the default method as - Switch to Default Content method. This allows you to navigate back to parent method and can be used as - driver.switchTo().defaultContent();

Need reliable QA resources to ramp up your existing processes, contact QASource's testing experts today.

Disclaimer

This publication is for informational purposes only, and nothing contained in it should be considered legal advice. We expressly disclaim any warranty or responsibility for damages arising out of this information and encourage you to consult with legal counsel regarding your specific needs. We do not undertake any duty to update previously posted materials.

Post a Comment

Categories