I've upgraded (again) to the latest snapshot of HtmlUnit, and the latest CR
of Rich Faces and still get the error below.  Why would the root DOM object
be set to an XmlPage instance instead of an HtmlPage instance?  

Any pointer on where to start debugging in HtmlUnit?



Valdis Rigdon wrote:
> 
> Using version R_1642 of webtest. I've tried with the libs released with
> R_1642, and all combinations of the latest snapshot (12-10-2007) of
> HtmlUnit and 1.6RC7 of rhino.
> 
> I'm trying to help test a Rich Faces application with some AJAX
> components.  I've turned up all WebTest logging and on the ajax form
> submit I see the request go over the wire via XmlHttpRequest and then come
> back with the expected XML response, with content-type of text/xml.
> 
> I see a log for "Calling onreadystatechange handler for state 4", and then
> I get this error:
> 
> <pre>
> org.mozilla.javascript.WrappedException: Wrapped
> java.lang.ClassCastException: com.gargoylesoftware.htmlunit.xml.XmlPage
> (http://localhost/cims/a4j_3_1_2.GAorg.ajax4jsf.javascript.AjaxScript.faces#37)
>         at
> org.mozilla.javascript.Context.throwAsScriptRuntimeEx(Context.java:1757)
>         at org.mozilla.javascript.MemberBox.invoke(MemberBox.java:170)
>         at
> org.mozilla.javascript.FunctionObject.call(FunctionObject.java:474)
>         at
> org.mozilla.javascript.Interpreter.interpretLoop(Interpreter.java:3237)
>         at
> script(http://localhost/cims/a4j_3_1_2.GAorg.ajax4jsf.javascript.AjaxScript.faces:37)
>         at
> script(http://localhost/cims/a4j_3_1_2.GAorg.ajax4jsf.javascript.AjaxScript.faces:43)
>         at
> script(http://localhost/cims/a4j_3_1_2.GAorg.ajax4jsf.javascript.AjaxScript.faces:68)
>         at
> script(http://localhost/cims/a4j_3_1_2.GAorg.ajax4jsf.javascript.AjaxScript.faces:22)
>         at
> org.mozilla.javascript.Interpreter.interpret(Interpreter.java:2394)
>         at
> org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:162)
>         at
> org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:393)
>         at
> com.gargoylesoftware.htmlunit.javascript.HtmlUnitContextFactory.doTopCall(HtmlUnitContextFactory.java:185)
>         at
> org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:2834)
>         at
> org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:160)
>         at
> com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.callFunction(JavaScriptEngine.java:478)
>         at
> com.gargoylesoftware.htmlunit.javascript.host.XMLHttpRequest.setState(XMLHttpRequest.java:154)
>         at
> com.gargoylesoftware.htmlunit.javascript.host.XMLHttpRequest.doSend(XMLHttpRequest.java:407)
>         at
> com.gargoylesoftware.htmlunit.javascript.host.XMLHttpRequest.access$000(XMLHttpRequest.java:74)
>         at
> com.gargoylesoftware.htmlunit.javascript.host.XMLHttpRequest$1.run(XMLHttpRequest.java:351)
>         at org.mozilla.javascript.Context.call(Context.java:577)
>         at org.mozilla.javascript.Context.call(Context.java:499)
>         at
> com.gargoylesoftware.htmlunit.javascript.host.XMLHttpRequest$2.run(XMLHttpRequest.java:357)
>         at java.lang.Thread.run(Thread.java:595)
>         at
> com.gargoylesoftware.htmlunit.ThreadManager$1.run(ThreadManager.java:120)
> Caused by: java.lang.ClassCastException:
> com.gargoylesoftware.htmlunit.xml.XmlPage
>         at
> com.gargoylesoftware.htmlunit.javascript.host.Document.jsxFunction_getElementById(Document.java:872)
>         at sun.reflect.GeneratedMethodAccessor276.invoke(Unknown Source)
>         at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>         at java.lang.reflect.Method.invoke(Method.java:585)
>         at org.mozilla.javascript.MemberBox.invoke(MemberBox.java:155)
>         ... 18 more
> </pre>
> 
> Relevant part of onreadystatechangehandler:
> 
> <pre>
> if (_this._request.responseXML) {
>                     _this._parsingStatus =
> Sarissa.getParseErrorText(_this._request.responseXML);
>                     if (_this._parsingStatus == Sarissa.PARSED_OK &&
> Sarissa.setXpathNamespaces) {
>                        
> Sarissa.setXpathNamespaces(_this._request.responseXML,
> "xmlns='http://www.w3.org/1999/xhtml'");
>                     }
>                 }
>                 if (_this.onready) {
>                     _this.onready(_this);
>                 }
> </pre>
> 
> The framework is generating the response and all the javascript on the
> frontend, so trying to break this down to a reproducable test case isn't
> easy.  I was hoping that some one on this list is using Rich Faces and
> WebTest and may have a few tips.
> 
> I've seen previous bugs that have been fixed in HtmlUnit for
> ClassCastException errors with XmlPage.  Is this related?
> 

-- 
View this message in context: 
http://www.nabble.com/ClassCastException%3A-XmlPage-tp14336206p14375838.html
Sent from the WebTest mailing list archive at Nabble.com.

_______________________________________________
WebTest mailing list
[email protected]
http://lists.canoo.com/mailman/listinfo/webtest

Reply via email to