我正在尝试访问来自 HtmlUnit 的页面https://www-banner.aub.edu.lb/pls/weba/bwckschd.p_disp_dyn_sched。当您从任何浏览器访问该页面时,该页面不需要任何身份验证,但是,当您通过代码访问它时,它会将我重定向到登录页面!有什么解释和解决办法吗?
这是我的代码:
final WebClient webClient = new WebClient();
// Get the first page
final HtmlPage page1 = webClient.getPage("http://www-banner.aub.edu.lb/pls/weba/bwckschd.p_disp_dyn_sched");
// Get the form that we are dealing with and within that form,
// find the submit button and the field that we want to change.
final HtmlForm form=page1.getFirstByXPath("//form[@action='/pls/weba/bwckgens.p_proc_term_date']");
final HtmlSubmitInput button = form.getInputByValue("Submit");
final HtmlHiddenInput field = form.getInputByName("p_calling_proc");
// Change the value of the text field
field.setValueAttribute("201350");
// Now submit the form by clicking the button and get back the second page.
final HtmlPage page2 = button.click();