code: @Given("^I switch to the iframe on index '(\\d+?)'$")
      public void seleniumSwitchFrame(Integer index) {
  
          assertThat(commonspec.getPreviousWebElements()).as("There are less found elements than required")
                  .hasAtLeast(index);
  
          WebElement elem = commonspec.getPreviousWebElements().getPreviousWebElements().get(index);
          commonspec.getDriver().switchTo().frame(elem);
      }
docs: Switches to a frame/ iframe.