[Httpunit-develop] Problem with page using Javascript/VB script
Brought to you by:
russgold
From: Unchis, D. <DU...@co...> - 2003-01-17 14:03:09
|
Hi all, We have several pages that use Visual Basic's MsgBox - instead of javascript's confirm(msg): <SCRIPT LANGUAGE=VBScript TYPE="text/vbscript"> <!-- Function makeMsgBox(title,mess,icon,buts,defbut,mods) butVal = buts + (icon*16) + (defbut*256) + (mods*4096) makeMsgBox = MsgBox(mess,butVal,title) End Function --> </script> The makeMsgBox function is called in some javascript: function newConfirm(title,mess,icon,defbut,mods) { icon = (icon==0) ? 0 : 2; defbut = (defbut==0) ? 0 : 1; retVal = makeMsgBox(title,mess,icon,4,defbut,mods); retVal = (retVal==6); return retVal; } When the pages are run with httpunit they blow up. I've set "HttpUnitOptions.setExceptionsThrownOnScriptError( false );" and I no longer get the erros, but then the page does not save the data to the database since newConfirm is part of the page validation on a save. Is there anyway to write something in httpunit to handle this? (I've placed the error below.) Thanks. Debbie [java] 1) WorkflowTest.testAquireTask() [java] com.meterware.httpunit.ScriptException: Script 'Function makeMsgBox(title,mess,icon,butsdefbut,mods) [java] butVal = buts + (icon*16) + (defbut*256) + (mods*4096) [java] makeMsgBox = MsgBox(mess,butVal,title) [java] End Function [java] ' failed: SyntaxError: missing ; before statement (httpunit; ) [java] at com.meterware.httpunit.javascript.JavaScript$JavaScriptEngine.handleScriptEx ception(JavaScript.java:182) [java] at com.meterware.httpunit.javascript.JavaScript$JavaScriptEngine.executeScript( JavaSript.java:119) [java] at com.meterware.httpunit.scripting.ScriptableDelegate.runScript(ScriptableDele gate.java:55) [java] at com.meterware.httpunit.WebResponse$Scriptable.load(WebResponse.java:574) [java] at com.meterware.httpunit.javascript.JavaScript$Window.initialize(JavaScript.ja va:39) [java] at com.meterware.httpunit.javascript.JavaScript.run(JavaScript.java:80) [java] at com.meterware.httpunit.javascript.JavaScriptEngineFactory.associate(JavaScri ptEngneFactory.java:46) [java] at com.meterware.httpunit.FrameHolder.updateFrames(FrameHolder.java:82) [java] at com.meterware.httpunit.WebWindow.updateFrameContents(WebWindow.java:184) [java] at com.meterware.httpunit.WebClient.updateFrameContents(WebClient.java:472) [java] at com.meterware.httpunit.WebWindow.updateWindow(WebWindow.java:167) [java] at com.meterware.httpunit.WebWindow.getResponse(WebWindow.java:111) [java] at com.meterware.httpunit.WebClient.getResponse(WebClient.java:113) [java] at com.coral.eai.test.func.desi.WorkflowTest.testAquireTask(WorkflowTest.java:1 54) [java] [java] FAILURES!!! [java] Tests run: 1, Failures: 0, Errors: 1 |