I have some problem with using httpunit 1.5.3.
I'am using Tapestry framework. Base URL of my application is (for example) http://localhost:8080/xadius/app
Code of my testcase is
[code]
import com.meterware.httpunit.*;
public class SimpleTestCase {
public static void main( String[] params )
{
try
{
WebConversation wc = new WebConversation();
But exeption happens:
[error]
ConversationError: The undefined value has no
properties. (httpunit; line 2)
at org.mozilla.javascript.NativeGlobal.constructError (NativeGlobal.java:590)
at org.mozilla.javascript.NativeGlobal.constructError (NativeGlobal.java:550)
at org.mozilla.javascript.ScriptRuntime.getProp(ScriptRuntime.java:714)
at org.mozilla.javascript.gen.c25.call (httpunit:2)
at org.mozilla.javascript.ScriptRuntime.call(ScriptRuntime.java:1193)
at org.mozilla.javascript.gen.c25.call (httpunit:3)
at org.mozilla.javascript.Interpreter.interpret (Interpreter.java:2179)
at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:58)
at com.meterware.httpunit.javascript.JavaScript$JavaScriptEngine.performEvent(JavaScript.java:162)
at com.meterware.httpunit.scripting.ScriptableDelegate.doEvent(scriptableDelegate.java:55)
at com.meterware.httpunit.WebResponse4Scriptable.load(Webresponse.java:578)
at com.meterware.httpunit.javascript.JavaScript$Window.initialize (JavaScript.java:419)
at com.meterware.httpunit.javascript.JavaScript.run(JavaScript.java:80)
at com.meterware.httpunit.javascript.JavaScriptEngineFactory.assosiate(JavaScriptEngineFactory.java:46)
at com.meterware.httpunit.RequestContext.runScripts(requestContext.java:44)
at com.meterware.httpunit.WebWindow.getResponse(WebWindow.java:119)
at com.meterware.httpunit.WebWindow.getResponse(webWindow.java:99)
at com.meterware.httpunit.WebClient.getResponse(webClient.java:87)
at SimpleTestCase.main(SimpletestCase.java:12)
Exeption: com.meterware.httpunit.ScriptExeption: Event 'javascript:tapestry_onLoad();' failed: ConversationError: The undefined value has no properties. (httpunit; line 2)
[/error]
Web page is
[html]
<html>
<head>
<title>Xadius</title>
<meta http-equiv="content-type" content="text/html; charset=windows-1251">
</head>
<script language="JavaScript"><!--
function tapestry_onLoad()
{
loadForm();
}
// --></script>
<body onLoad="javascript:tapestry_onLoad();">
<script type="text/javascript">
var errorField="";
var dialogOpened=false;
</script>
<script language="JavaScript">
<!--
function loadForm()
{
window.history.forward(-1);
moveTo(0,0);
resizeTo(screen.width,screen.height);
setCursor();
}
// -->
</script>
...........................
</body>
</html>
[/html]
How can I fix this problem?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Good time of day!
I have some problem with using httpunit 1.5.3.
I'am using Tapestry framework. Base URL of my application is (for example) http://localhost:8080/xadius/app
Code of my testcase is
[code]
import com.meterware.httpunit.*;
public class SimpleTestCase {
public static void main( String[] params )
{
try
{
WebConversation wc = new WebConversation();
WebResponse response = wc.getResponse
( "http://localhost:8080/xadius/app" );
System.out.println(response.toString());
}
catch (Exception e)
{
System.err.println( "Exception: " + e );
}
}
}
[/code]
But exeption happens:
[error]
ConversationError: The undefined value has no
properties. (httpunit; line 2)
at org.mozilla.javascript.NativeGlobal.constructError (NativeGlobal.java:590)
at org.mozilla.javascript.NativeGlobal.constructError (NativeGlobal.java:550)
at org.mozilla.javascript.ScriptRuntime.getProp(ScriptRuntime.java:714)
at org.mozilla.javascript.gen.c25.call (httpunit:2)
at org.mozilla.javascript.ScriptRuntime.call(ScriptRuntime.java:1193)
at org.mozilla.javascript.gen.c25.call (httpunit:3)
at org.mozilla.javascript.Interpreter.interpret (Interpreter.java:2179)
at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:58)
at com.meterware.httpunit.javascript.JavaScript$JavaScriptEngine.performEvent(JavaScript.java:162)
at com.meterware.httpunit.scripting.ScriptableDelegate.doEvent(scriptableDelegate.java:55)
at com.meterware.httpunit.WebResponse4Scriptable.load(Webresponse.java:578)
at com.meterware.httpunit.javascript.JavaScript$Window.initialize (JavaScript.java:419)
at com.meterware.httpunit.javascript.JavaScript.run(JavaScript.java:80)
at com.meterware.httpunit.javascript.JavaScriptEngineFactory.assosiate(JavaScriptEngineFactory.java:46)
at com.meterware.httpunit.RequestContext.runScripts(requestContext.java:44)
at com.meterware.httpunit.WebWindow.getResponse(WebWindow.java:119)
at com.meterware.httpunit.WebWindow.getResponse(webWindow.java:99)
at com.meterware.httpunit.WebClient.getResponse(webClient.java:87)
at SimpleTestCase.main(SimpletestCase.java:12)
Exeption: com.meterware.httpunit.ScriptExeption: Event 'javascript:tapestry_onLoad();' failed: ConversationError: The undefined value has no properties. (httpunit; line 2)
[/error]
Web page is
[html]
<html>
<head>
<title>Xadius</title>
<meta http-equiv="content-type" content="text/html; charset=windows-1251">
</head>
<script language="JavaScript"><!--
function tapestry_onLoad()
{
loadForm();
}
// --></script>
<body onLoad="javascript:tapestry_onLoad();">
<script type="text/javascript">
var errorField="";
var dialogOpened=false;
</script>
<script language="JavaScript">
<!--
function loadForm()
{
window.history.forward(-1);
moveTo(0,0);
resizeTo(screen.width,screen.height);
setCursor();
}
// -->
</script>
...........................
</body>
</html>
[/html]
How can I fix this problem?
Looks like a problem with the Javascript. Try:
HttpUnitOptions.setExceptionsThrownOnScriptError( false );
in your code, and see if it then works.
Now it works, but where nothing unusual in my example =(. What dont supported by HttpUnit?