我正在尝试使用 HTMLUnit 登录一个站点,但是每当我提交登录详细信息时,我都会收到大量错误。我把我的代码分成小块,这样我就可以看到它是在点击提交按钮之后,但在其他任何事情发生之前;它需要一段时间,因为它是一个非常慢的网站。不幸的是,因为它发生在登录后,所以我无法向您展示它的含义。我可以说成功登录有一些重定向,因为它给了我一个页面未找到错误,我假设它是导致问题的重定向之一。我以前在 Chrome 上遇到过重定向问题,虽然不是在这个特定的页面上,但现在 Chrome 和 IE8 都在为我加载它。
为您保存完整的堆栈跟踪,以下是最重要的内容:
SEVERE: Error loading JavaScript from [http://servicedeskmt.det.nsw.edu.au:8090/kinetic/displayPage.jsp/../resources/js/jquery/jquery-1.3.2.js].
com.gargoylesoftware.htmlunit.FailingHttpStatusCodeException: 404 /kinetic/resources/js/jquery/jquery-1.3.2.js for http://servicedeskmt.det.nsw.edu.au:8090/kinetic/resources/js/jquery/jquery-1.3.2.js
at com.gargoylesoftware.htmlunit.WebClient.throwFailingHttpStatusCodeExceptionIfNecessary(WebClient.java:535)
INFO: statusCode=[404] contentType=[text/html]
Oct 31, 2011 2:31:29 PM com.gargoylesoftware.htmlunit.WebClient printContentIfNecessary
INFO: <html>
<head>
<title>Page cannot be found</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div align="center">
<p> </p>
<p> </p>
<p><b><font face="Verdana, Arial, Helvetica, sans-serif" size="2">There was
an error on the page you were attempting to reach or the page could not be
found.</font></b> <br>
</p>
<p><br>
<br> …Run Code Online (Sandbox Code Playgroud)