[Webtest] runtimeError: message=[Bad method parameters for "init".]

Christian Möller webtest@lists.canoo.com
Wed, 08 Jun 2005 13:54:33 +0200


Hi Marc,

OK, with JS logging activated it looks like this on the Solaris integration:

==========================================
INFO (com.canoo.webtest.steps.request.Target) - -> gotoTarget(by url):
http://[integration-ip]18080/rri/index.html
DEBUG
(com.gargoylesoftware.htmlunit.javascript.configuration.JavaScriptConfiguration)
- browser tag not yet handled for class
com.gargoylesoftware.htmlunit.javascript.host.ActiveXObject
DEBUG
(com.gargoylesoftware.htmlunit.javascript.configuration.JavaScriptConfiguration)
- javascript tag not yet handled for class
com.gargoylesoftware.htmlunit.javascript.host.Anchor
ERROR (com.gargoylesoftware.htmlunit.ScriptEngine) - runtimeError:
message=[Bad method parameters for "init".] sourceName=[null] line=[0]
lineSource=[null] lineOffset=[0]
INFO (com.canoo.webtest.steps.Step) - Exception thrown from this class:
org.apache.xerces.xni.XNIException
ERROR (com.canoo.webtest.steps.Step) - Cannot handle unexpected
exception in step InvokePage at
/local/ci/tools/ci/workspaces/RRI-Web/config/canoo/login_de.xml:3:  with
(stepid="Invoke login page", url="index.html", stepType="invoke")
 org.apache.xerces.xni.XNIException
     at
org.cyberneko.html.HTMLScanner$ContentScanner.scan(HTMLScanner.java:1860)
...
==========================================

And here is the log output from running the same test on my local
Win2000 machine with activated JS logging:

==========================================
INFO (com.canoo.webtest.steps.request.Target) - -> gotoTarget(by url):
http://localhost:8080/rri/index.html
DEBUG
(com.gargoylesoftware.htmlunit.javascript.configuration.JavaScriptConfiguration)
- browser tag not yet handled for class
com.gargoylesoftware.htmlunit.javascript.host.ActiveXObject
DEBUG
(com.gargoylesoftware.htmlunit.javascript.configuration.JavaScriptConfiguration)
- javascript tag not yet handled for class
com.gargoylesoftware.htmlunit.javascript.host.Anchor
DEBUG (com.gargoylesoftware.htmlunit.javascript.host.Window) - No
configured setter "submitLink" found for
com.gargoylesoftware.htmlunit.javascript.host.Window@1d49247. Setting it
as pure javascript property.
DEBUG
(com.gargoylesoftware.htmlunit.javascript.configuration.JavaScriptConfiguration)
- browser tag not yet handled for class
com.gargoylesoftware.htmlunit.javascript.host.ActiveXObject
DEBUG
(com.gargoylesoftware.htmlunit.javascript.configuration.JavaScriptConfiguration)
- javascript tag not yet handled for class
com.gargoylesoftware.htmlunit.javascript.host.Anchor
DEBUG
(com.gargoylesoftware.htmlunit.javascript.configuration.JavaScriptConfiguration)
- Mapping com.gargoylesoftware.htmlunit.html.HtmlTableHeader to TableHeader
DEBUG
(com.gargoylesoftware.htmlunit.javascript.configuration.JavaScriptConfiguration)
- Mapping com.gargoylesoftware.htmlunit.html.HtmlInlineFrame to FrameInline
DEBUG
(com.gargoylesoftware.htmlunit.javascript.configuration.JavaScriptConfiguration)
-    testing to use Frame
DEBUG
(com.gargoylesoftware.htmlunit.javascript.configuration.JavaScriptConfiguration)
- Mapping com.gargoylesoftware.htmlunit.html.HtmlTextInput to Text
DEBUG
(com.gargoylesoftware.htmlunit.javascript.configuration.JavaScriptConfiguration)
-    testing to use Input
DEBUG
(com.gargoylesoftware.htmlunit.javascript.configuration.JavaScriptConfiguration)
- Mapping com.gargoylesoftware.htmlunit.html.HtmlTable to Table
...
==========================================

Here everything works fine!
Bye the way, page "index.html" contains no JS or anything else - it's
just static HTML. But the next page
"http://[integration_ip]:18080/rri/app" (loaded via refresh meta tag)
contains a "Form Submit Link" - a HTML anchor element triggering the
submit of a form via JS:

==========================================
<script language="JavaScript" type="text/javascript"> <!--
function submitLink(form, elementId) { form._linkSubmit.value =
elementId; if (form.onsubmit == null || form.onsubmit()) form.submit(); }
// --></script>

...

<a href="javascript:submitLink(document.Form0,&quot;$LinkSubmit&quot;);"
tabindex="3">
	Anmelden
</a>
==========================================

Maybe this is the problem? But why does it run successfully on my local
Win2000?

Strange.

Christian

> Hallo Christian,
> 
> this comes probably from a Javascript error occuring in an inline script while the page is loaded. This may be an error 
> in your script or more probably because your page uses something that is not yet supported by htmlunit. You can turn the 
> js log level to debug (in lib/log4j.properties) to see more informations)
> 
> Marc.
> 
> Christian Möller wrote:
>> Hi,
>> 
>> I'm using Webtest (build 834, downloaded this morning) on my local
>> Win2000 machine and on an integration platform with Solaris.
>> 
>> Further characteristics of the environment:
>> JDK 1.4.2 on both machines
>> Ant 1.6.1 on Solaris, 1.6.5 locally on Win2000
>> Tomcat 5.0.27 on Solaris, 5.5.9 locally on Win2000
>> 
>> Locally the test I've written runs successfully, but executing the test
>> on Solaris failed due to:
>> 
>> ==========================================
>> INFO (com.canoo.webtest.steps.request.Target) - -> gotoTarget(by url):
>> http://[integration_ip]:18080/rri/index.html
>> ERROR (com.gargoylesoftware.htmlunit.ScriptEngine) - runtimeError:
>> message=[Bad method parameters for "init".] sourceName=[null] line=[0]
>> lineSource=[null] lineOffset=[0]
>> INFO (com.canoo.webtest.steps.Step) - Exception thrown from this class:
>> org.apache.xerces.xni.XNIException
>> ERROR (com.canoo.webtest.steps.Step) - Cannot handle unexpected
>> exception in step InvokePage at
>> /local/ci/tools/ci/workspaces/RRI-Web/config/canoo/login_de.xml:3:  with
>> (stepid="Invoke login page", url="index.html", stepType="invoke")
>>  [testSpec] org.apache.xerces.xni.XNIException
>>  [testSpec]     at
>> org.cyberneko.html.HTMLScanner$ContentScanner.scan(HTMLScanner.java:1860)
>> ...
>> ==========================================
>> 
>> The "index.html" referenced in the test looks like this:
>> 
>> ==========================================
>> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
>> 
>> <html>
>> <head>
>> <meta http-equiv="refresh" content="0; URL=app">
>> </head>
>> <body>
>> &nbsp;
>> </body>
>> </html>
>> ==========================================
>> 
>> Entering "http://[integration_ip]:18080/rri/index.html" at my browser
>> shows the expected result: After the refresh I get the page from
>> "http://[integration_ip]:18080/rri/app".
>> Attribute "autorefresh" of element "config" is set to "true" (otherwise
>> it won't work locally, too).
>> 
>> I'm confused what might went wrong here. Maybe there is somebody out
>> there who can help? Thanks in advance.
>> 
>> Christian