The are two form elements on https://login.microsoftonline.com: an email input with id i0116 and a submit button with id idSIButton9, but they are does not seem to be accessible with HtmlUnit
code example:
String msOnlineLoginURI = "https://login.microsoftonline.com";
String loginFormId = "i0281";
String emailInputId = "i0116";
String submitButtonId = "idSIButton9";
final WebClient webClient = new WebClient(BrowserVersion.BEST_SUPPORTED);
webClient.setRefreshHandler(new ImmediateRefreshHandler());
webClient.setCookieManager(new CookieManager());
webClient.getOptions().setRedirectEnabled(true);
webClient.getOptions().setJavaScriptEnabled(true);
webClient.getOptions().setThrowExceptionOnScriptError(false);
webClient.getOptions().setThrowExceptionOnFailingStatusCode(false);
try {
HtmlPage page = webClient.getPage(msOnlineLoginURI);
webClient.waitForBackgroundJavaScript(5000);
if (page.getElementById(loginFormId) != null) {
HtmlEmailInput emailInput = (HtmlEmailInput) page.getElementById(emailInputId);
HtmlSubmitInput submitInput = (HtmlSubmitInput) page.getElementById(submitButtonId);
}
} catch (IOException e) {
}
Result: form is found by id, but both emailInput and submitInbut are null
the same issue with the latest 2.35.0