JAVA: htmlunit show content of aspx page (school timetable)

AXDetduamma

New Member
I am working on a program that shows my timetable (school) at the click of a button. I am doing this because I am lazy and want to improve my java "skills". After 2 days of searching the web I finally came here to ask for help, I have no idea on how to "print" or show the content of an aspx page (timeable is in .aspx)(I am using Htmlunit)This is the code I have atm:\[code\] private static void setCredentials(WebClient webClient){ String username = "MY EMAIL HERE"; String password = "MY PASS HERE"; String base64encodedUsernameAndPassword = base64Encode(username + ":" + password); webClient.addRequestHeader("Authorization", "Basic " + base64encodedUsernameAndPassword);}private static String base64Encode(String stringToEncode){ return DatatypeConverter.printBase64Binary(stringToEncode.getBytes());}public static void main(String[] args) throws Exception { WebClient webClient = new WebClient(); setCredentials(webClient); webClient.setThrowExceptionOnScriptError(true); HtmlPage page = (HtmlPage) webClient.getPage("https://roosters.kdg.be/1213/student/Default.aspx"); HtmlForm form = page.getFormByName("form1"); // Enter login and passwd form.getInputByName("tWildcard").setValueAttribute("MY NAME HERE"); form.getInputByName("bWildcard").click(); HtmlSelect select = (HtmlSelect) form.getElementById("dlObject"); HtmlOption option = select.getOptionByValue("MY EMAIL HERE"); select.setSelectedAttribute(option, true); System.out.println(option.getText().toString()); page = (HtmlPage) form.getInputByName("bGetTimetable").click();}\[/code\]At the end you see \[code\]page = (HtmlPage) form.getInputByName("bGetTimetable").click();\[/code\]this is the button which opens my timetable (.aspx)Some screens to make it visual:fill in info to enter timetabletimetableI would be very happy if somebody could explain me how to "download","print" its contentThanks in advance!
 
Back
Top