I am trying to submit my account info into this page (https://yoyaku.sports.metro.tokyo.lg.jp/user/view/user/homeIndex.html?te-uniquekey=1887c057141). But for some reason, when I use click method in navigateToOldVotePage function in below, it shows me username and password is empty error. I cannot figure out why the entered information is not submitted...
public static HtmlPage loginToVotePage(WebClient webClient, Account account) {
HtmlPage loginPage = navigateToLoginPage(webClient);
HtmlPage loginPage = navigateToOldLoginPage(webClient);
return navigateToOldVotePage(loginPage, account);
}
private static HtmlPage navigateToOldLoginPage(WebClient webClient) {
try {
HtmlPage page = webClient.getPage(OLD_HOME_URL);
final List<FrameWindow> window = page.getFrames();
final HtmlPage pageTwo = (HtmlPage) window.get(1).getEnclosedPage();
HtmlAnchor loginAnchor = pageTwo.getFirstByXPath(OLD_LOGIN_XPATH);
return loginAnchor.click();
} catch (Exception e) {
System.err.println("Error happend duing navigating to login page: " + e);
}
return null;
}
private static HtmlPage navigateToOldVotePage(HtmlPage page, Account account) {
try {
HtmlInput userInput = page.getElementByName("userId");
HtmlInput pwdInput = page.getElementByName("password");
userInput.setValueAttribute(account.toeiId);
pwdInput.setValueAttribute(account.password);
HtmlAnchor submitLogin = page.getFirstByXPath("//*[@id='disp']/center/form/table[5]/tbody/tr[1]/td[2]/table/tbody/tr[2]/td/a");
HtmlPage loggedIn = submitLogin.click();
// 168...: /web/rsvWUA_Action.do
System.out.println(loggedIn.asXml());
} catch (Exception e) {
System.err.println("Error happend duing loging process: " + e);
}
return null;
}