Hi!
OS: WIN XP / Java 1.6
Webtest version: R_1766
I have a problem with webtest trying to automate the log in process of the
following web page (generated by JSP):
[...]
<head>
<title>MyStuff</title>
<meta http-equiv="Pragma" content="no-cache">
<meta http-equiv="Pragma" content="no-store">
<meta http-equiv="expires" content="0">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<link rel="shortcut icon" href="/static/images/fav.ico"/>
<link rel="stylesheet" type="text/css" href="/static/css/main.css"/>
<script type="text/javascript" src="/static/scripts/main.js"></script>
<script type="text/javascript" src="/static/scripts/popup.js"></script>
<!-- compliance patch for microsoft browsers --><!--[if lt IE 7]>
<script src="/static/ie7/ie7-core.js" type="text/javascript"></script>
<script src="/static/ie7/ie7-css2-selectors.js"
type="text/javascript"></script>
<![endif]-->
</head>
<body>
[...]
<form id="loginForm" method="post" action="/somewhere/pages/login.jsp"
enctype="application/x-www-form-urlencoded">
<table id="loginForm:grid_login">
<tbody>
<tr>
<td><label for="loginForm:username">
Benutzername:</label></td>
<td><input id="loginForm:username" type="text" name="loginForm:username"
class="text" maxlength="64" size="64" tabindex="0" /></td>
</tr>
<tr>
<td><label for="loginForm:password">
Passwort:</label></td>
<td><input id="loginForm:password" type="password" name="loginForm:password"
value="" maxlength="64" size="64" class="password" /></td>
</tr>
<tr>
<td><input id="loginForm:btn_login" type="submit" name="loginForm:btn_login"
value="Anmelden" onclick="clearFormHiddenParams_loginForm(this.form.id);"
class="default-button" /></td>
<td></td>
</tr>
</tbody>
</table>
<input type="hidden" name="com.sun.faces.VIEW" id="com.sun.faces.VIEW"
value="_id44:_id45" /><input type="hidden" name="loginForm" value="loginForm" />
<script type="text/javascript">
<!--
function clearFormHiddenParams_loginForm(curFormName) {
var curForm = document.forms[curFormName];
}
//-->
</script>
</form>
</div>
<script type="text/javascript"> getElement('loginForm:username').focus();
</script>
</body>
</html>
Webtests reports a 404 exception if I run the test against the static html file
listed above on a locally installed web server (file encoded UTF-8).
Now if I remove
<script type="text/javascript"> getElement('loginForm:username').focus();
</script>
...and all the header content
<title>MyStuff</title>
[...]
<script src="/static/ie7/ie7-css2-selectors.js"
type="text/javascript"></script>
<![endif]-->
...it works and I can access the input fields
Here is the output:
C:\Programme\Webtest\bin>webtest -buildfile
c:\Programme\Webtest\webtest\add-update-server-accounts.xml
"java.exe" -Xms64M -Xmx256M -cp
"C:\Programme\Webtest\bin\..\lib\ant-launcher-1.7.0.jar"
-Dant.library.dir="C:\Programme
\Webtest\bin\..\lib"
"-Dlog4j.configuration=file:/C:\Programme\Webtest\bin\..\lib/log4j.properties"
org.apache.tools.ant
.launch.Launcher -nouserlib -lib
"C:\Programme\Webtest\bin\..\lib\build;C:\Programme\Webtest\bin\..\lib\build\clover.jar
" -buildfile c:\Programme\Webtest\webtest\add-update-server-accounts.xml
Buildfile: c:\Programme\Webtest\webtest\add-update-server-accounts.xml
[echo] DEPRECATED since November 2007: use webtest.xml instead of
lib/taskdef.xml!
[echo] DEPRECATED since November 2007: use webtest.xml instead of
lib/classpath.xml!
addCustomers:
[webtest] INFO (com.canoo.webtest.ant.WebtestTask) - Starting webtest
"addCustomers" (c:\Programme\Webtest\webtest\add-update-server-accounts.xml:21:
)
[webtest] INFO (com.canoo.webtest.ant.WebtestTask) - Canoo Webtest: R_1766.
[config] INFO (com.canoo.webtest.engine.Configuration) - Creating result
directory: c:\Programme\Webtest\webtest\webtest-results\129_AddCustomers
[config] INFO (com.canoo.webtest.engine.Configuration) - Surfing with
default browser Mozilla/4.0 (compatible; MSIE
6.0; Windows 98)
[steps] INFO (com.canoo.webtest.steps.Step) - >>>> Start Step: steps (1/4)
[invoke] INFO (com.canoo.webtest.steps.Step) - >>>> Start Step: invoke "go
to start page" (1/4)
[invoke] INFO (com.canoo.webtest.steps.request.TargetHelper) - getting
response for url: http://localhost/login.htm
[invoke] INFO (org.apache.commons.httpclient.HttpMethodBase) - Response
content length is not known
[invoke] INFO (com.gargoylesoftware.htmlunit.WebClient) - statusCode=[404]
contentType=[text/html]
[invoke] INFO (com.gargoylesoftware.htmlunit.WebClient) - <html>
[invoke] <head>
[invoke] <meta http-equiv="content-type" content="text/html;
charset=UTF-8" />
[invoke] <style>
[...]
[invoke] </style>
[invoke] </head>
[invoke] <body>
[invoke] <h1>404 - Not found</h1>
[invoke] <a href="/">go to root</a>
[...]
INFO (com.canoo.webtest.engine.WebClientContext) - Responses restored
INFO (com.canoo.webtest.ant.WebtestTask) - Finished executing webtest
"addCustomers" (c:\Programme\Webtest\webtest
\add-update-server-accounts.xml:21: )
INFO (com.canoo.webtest.reporting.XmlReporter) - Writing report to
c:\Programme\Webtest\webtest\webtest-results\12
9_AddCustomers\WebTestReport.xml
INFO (com.canoo.webtest.ant.WebtestTask) - Test report successfully created.
BUILD FAILED
c:\Programme\Webtest\webtest\login.xml:2: HTTP error 404
So why do these two parts mentioned above spoil my test attempts?
If you need some part of the script, just let me know. I had to cut down the
code and response not to exceed the limit of 40 KB.
Thanks in advance,
Ralf