@Override
  protected void openBrowserWindow() throws HiveJdbcBrowserException {
    // if user and password are null, we fallback to real browser for interactive mode
    if (username == null && password == null) {
      super.openBrowserWindow();
      return;
    }
    try (WebClient webClient = new WebClient()) {
      final HtmlPage page = webClient.getPage(String.valueOf(clientContext.getSsoUri()));
      final HtmlForm form = page.getFormByName("f");
      final HtmlInput usernameInput = form.getInputByName("username");
      final HtmlInput passwordInput = form.getInputByName("password");
      usernameInput.setValueAttribute(username);
      passwordInput.setValueAttribute(password);
      for (DomElement element : page.getElementsByTagName("button")) {
        if ("button".equals(element.getTagName())) {
          element.click();
        }
      }
    } catch (IOException e) {
      throw new HiveJdbcBrowserException(e);
    }
  }
HTMLUnit based {@link IJdbcBrowserClient} for testing purposes.
itests/hive-unit/src/test/java/org/apache/hive/jdbc/saml/SimpleSAMLPhpTestBrowserClient.java