我正在使用内部网站点。当我通过Chrome或IE浏览器登录" https://itam.flextron.com.au/arsys/shared/login.jsp" 网站时,它的工作正常。然而,当我通过浏览器登录网站时,会弹出一个窗口并自动关闭,然后显示登录页面。
但是,当我通过HTMLUNIT访问内部网页时,它就是'使用一些html代码抛出异常。
公共类TestClass {
public static void homePage() throws Exception {
WebClient webClient = new WebClient(BrowserVersion.CHROME);
HtmlPage page = webClient.getPage("https://itam.flextron.com.au/arsys/shared/login.jsp");
System.out.print("Accessing the webpage...");
System.out.print(page.asText());
webClient.closeAllWindows();
}
public static void main(String arg[])
{
try {
homePage();
}
catch(Exception e)
{
System.out.print("Exception : "+ e);
}
}
}
**
例外:
**
Sep 27, 2014 11:47:17 PM com.gargoylesoftware.htmlunit.IncorrectnessListenerImpl notify
WARNING: Obsolete content type encountered: 'application/x-javascript'.
Sep 27, 2014 11:47:17 PM com.gargoylesoftware.htmlunit.WebClient printContentIfNecessary
INFO: statusCode=[404] contentType=[text/html]
Sep 27, 2014 11:47:17 PM com.gargoylesoftware.htmlunit.WebClient printContentIfNecessary
INFO:
<HTML>
<HEAD>
<title>BMC Remedy Mid Tier 7.1 - Error page</title><!--;-->
<style type="text/css">
<!--
BODY {font-family:Tahoma,arial,helvetica,verdana;}
.ErrorTitle {font-size:12pt; font-weight:bold; text-align:left;}
.ErrorMsg {font-size:12pt; text-align:left;}
.ReturnHome {font-size:10pt;}
#product {position: absolute; top:20px; left: 0px; font: 16px "Arial", "Lucida Grande", "Verdana", "Helvetica", sans-serif; font-weight: bold; color: #ffffff; padding-left:18px; text-align:left;}
#logo {position: absolute; top:15px; right:0px}
-->
</style>
<script>
function setOverride(yesno) {
document.overrideForm.ipoverride.value = yesno;
document.overrideForm.submit();
}
</script>
</HEAD>
<BODY style="background-repeat: no-repeat" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<table border=0 cellpadding="0" cellspacing="0" width="100%">
<!-- header table -->
<tr>
<td width="100%">
<table border=0 cellpadding="0" cellspacing="0" width="100%" height=60>
<tr>
<td height=60 background="/arsys/shared/images/bkgd_image.gif">
<span id="product"> </span>
<div id="logo" align="right">
<img src="/arsys/shared/images/bmc_logo.gif" width="118" height="26" hspace="20" alt="BMC logo">
</div>
</td>
</tr>
</table>
</td>
</tr>
</table>
<br>
<br>
<br>
<br>
<table>
<tr>
<td width=150 nowrap>
</td>
<td>
<div class="ErrorTitle">
The following error(s) occurred while trying to process your request:<!--;-->
</div>
<br>
<br>
<div class="ErrorMsg">
ARERR [9217]
<br>
File not found. Either the file requested is not present or the URL supplied is bad.
</div>
<br><br>
</td>
</tr>
<tr>
<td width=150 nowrap>
</td>
<td class="ReturnHome">
<a href=/arsys/home>Return to home page</a>
</td>
</tr>
</table>
<script>
var Msg="File not found. Either the file requested is not present or the URL supplied is bad.\n"
</script>
</BODY>
</HTML>
Exception: com.gargoylesoftware.htmlunit.ScriptException: Exception invoking open
&#13;