[Webtest] Re: AJAX (DWR) webtest Compatability
Marc Guillemot
webtest@lists.canoo.com
Wed, 07 Dec 2005 16:09:55 +0100
Hi Richard,
this comes from a currently incomplete implementation of XMLHttpRequest
in htmlunit. To be more precise the responseXML is not totally mapped to
be accessed using the normal JS syntax. In your case it is probably the
nodes that can't be accessed with syntax "nodes[0]".
Marc.
Richard HALLIER wrote:
> Hi all,
>
> I'm using the latest 1.7 version, build number = R_1041.
> It is a simple ajax action (Taconite implementation), on a change of a combobox, another is populated depending the value selected in the first one.
>
> Here is my webtest script :
>
> <setselectfield name="zone" optionIndex="1"/>
> <sleep description="pause for 5 sec" seconds="5"/> // Waiting the ajax rendering of the second combobox
> <clickButton description="Submit the form" label="${actions.add}" />
>
> Here is the error :
>
> INFO (com.canoo.webtest.steps.Step) - Start Step: setselectfield "<unknown>" (8/12)
> INFO (com.canoo.webtest.engine.Context) - Current form set to (action=addCountryToUser.html)
> INFO (com.canoo.webtest.steps.Step) - Start Step: sleep "pause for 5 sec" (8/12)
> INFO (com.canoo.webtest.extension.Sleep) - Sleeping for 5000 milliseconds
> INFO (com.canoo.webtest.engine.Context) - Content of window changed to http://localhost:8080/xxx/ajax/combobox.html?targetId=country&ts=1133965936390&zone=1
> INFO (com.canoo.webtest.engine.Context) - Webclient: com.gargoylesoftware.htmlunit.WebClient@ba5c7a
> INFO (com.canoo.webtest.engine.Context) - script engine: com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine@10d593e
> INFO (com.canoo.webtest.engine.Context) - Content of current window changed, it will become current response
> INFO (com.canoo.webtest.engine.Context) - Current form set to none
> INFO (com.canoo.webtest.engine.Context) - Changed last response to http://localhost:8080/xxx/ajax/combobox.html?targetId=country&ts=1133965936390&zone=1
> Exception in thread "XMLHttpRequest.send() Thread" org.mozilla.javascript.EvaluatorException: La classe Java "com.sun.org.apache.xerces.internal.dom.DeferredElementImpl" ne possède aucun champ ou aucune méthode d'instance publique appelé "0" (/afvp/scripts/taconite-client.js#268)
> at org.mozilla.javascript.DefaultErrorReporter.runtimeError(DefaultErrorReporter.java:95)
> at org.mozilla.javascript.Context.reportRuntimeError(Context.java:966)
> at org.mozilla.javascript.Context.reportRuntimeError(Context.java:1022)
> at org.mozilla.javascript.Context.reportRuntimeError2(Context.java:992)
> at org.mozilla.javascript.JavaMembers.reportMemberNotFound(JavaMembers.java:635)
> at org.mozilla.javascript.NativeJavaObject.get(NativeJavaObject.java:106)
> at org.mozilla.javascript.ScriptableObject.getProperty(ScriptableObject.java:1340)
> at org.mozilla.javascript.ScriptRuntime.getObjectElem(ScriptRuntime.java:1301)
> at org.mozilla.javascript.ScriptRuntime.getObjectElem(ScriptRuntime.java:1285)
> at org.mozilla.javascript.Interpreter.interpretLoop(Interpreter.java:2845)
> at script(/afvp/scripts/taconite-client.js:268)
> at script(/afvp/scripts/taconite-client.js:225)
> at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:2250)
> at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:149)
> at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:337)
> at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:2755)
> at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:147)
> at com.gargoylesoftware.htmlunit.javascript.host.XMLHttpRequest.setState(XMLHttpRequest.java:127)
> at com.gargoylesoftware.htmlunit.javascript.host.XMLHttpRequest.doSend(XMLHttpRequest.java:340)
> at com.gargoylesoftware.htmlunit.javascript.host.XMLHttpRequest.access$0(XMLHttpRequest.java:323)
> at com.gargoylesoftware.htmlunit.javascript.host.XMLHttpRequest$1.run(XMLHttpRequest.java:302)
> INFO (com.canoo.webtest.steps.Step) - Start Step: clickButton "Soumet le formulaire" (8/12)
> INFO (com.canoo.webtest.steps.request.AbstractTargetAction) - -> gotoTarget by clickButton with name: null
> INFO (com.canoo.webtest.steps.Step) - Exception thrown from this class: com.canoo.webtest.engine.StepExecutionException
> INFO (com.canoo.webtest.steps.Step) - Message was: Last response is not an HTML page but of type text/xml
> INFO (com.canoo.webtest.steps.Step) - Exception thrown from this class: com.canoo.webtest.engine.StepExecutionException
> INFO (com.canoo.webtest.steps.Step) - Message was: Last response is not an HTML page but of type text/xml
> INFO (com.canoo.webtest.steps.Step) - Exception thrown from this class: com.canoo.webtest.engine.StepExecutionException
> INFO (com.canoo.webtest.steps.Step) - Message was: Last response is not an HTML page but of type text/xml
> INFO (com.canoo.webtest.ant.WebtestTask) - Writing report using Report class: com.canoo.webtest.reporting.XmlReporter
> INFO (com.canoo.webtest.ant.WebtestTask) - Test summary successfully created.
>
> I can point out that manually everything works perfectly, so its clearly a problem with canoo web test/htmlunit.
> I dont know if it's a problem of javascript support or a response changed to xml (response to the ajax action) ?
>
> Have you any pointers?
>
> Thank you a lot.
> Richard
>
> _______________________________________________
> WebTest mailing list
> WebTest@lists.canoo.com
> http://lists.canoo.com/mailman/listinfo/webtest
>