code: public void switchWindow() {
          List<String> windowHandles = new ArrayList<>(getWindowHandles());
          getDriver().switchTo().window(windowHandles.get(windowHandles.size() - 1));
      }
docs: switches to the last opened window