code: @Given("^I switch to iframe with '([^:]*?):(.+?)'$")
      public void seleniumIdFrame(String method, String idframe) throws IllegalAccessException, NoSuchFieldException, ClassNotFoundException {
          assertThat(commonspec.locateElement(method, idframe, 1));
  
          if (method.equals("id") || method.equals("name")) {
              commonspec.getDriver().switchTo().frame(idframe);
          } else {
              throw new ClassNotFoundException("Can not use this method to switch iframe");
          }
      }
docs: Swith to the iFrame where id matches idframe
  
  @param idframe iframe to swith to
  @throws IllegalAccessException exception
  @throws NoSuchFieldException   exception
  @throws ClassNotFoundException exception