selenium-webdriverSwitching Frames


Syntax

  • Java
  • driver.switchTo().frame(String name);
  • driver.switchTo().frame(String id);
  • driver.switchTo().frame(int index);
  • driver.switchTo().frame(WebElement frameElement);
  • driver.switchTo().defaultContent();
  • C#
  • driver.SwitchTo().Frame(int frameIndex);
  • driver.SwitchTo().Frame(IWebElement frameElement);
  • driver.SwitchTo().Frame(string frameName);
  • driver.SwitchTo().DefaultContent();
  • Python
  • driver.switch_to_frame(nameOrId)
  • driver.switch_to.frame(nameOrId)
  • driver.switch_to_frame(index)
  • driver.switch_to.frame(index)
  • driver.switch_to_frame(frameElement)
  • driver.switch_to.frame(frameElement)
  • driver.switch_to_default_content()
  • driver.switch_to.default_content()
  • JavaScript
  • driver.switchTo().frame(nameOrId)
  • driver.switchTo().frame(index)
  • driver.switchTo().defaultContent()

Parameters

parameterdetails
nameOrIdSelect a frame by its name of id.
indexSelect a frame by its zero-based index.
frameElementSelect a frame using its previously located WebElement