Software Development and QA Tips By QASource Experts

How to Switch From Inner iFrame to the Parent iFrame?

Written by Timothy Joseph | Jan 24, 2022 5:00:00 PM

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.