Hallo Marc!

I am using Webtest 3.0, but as I wrote, I get the error in the latest snapshot 
as well.

We digged a little deeper and found, that the ScrollableDataTable of RichFaces 
causes the trouble. 

On our page we have the table inside a form. The Submit-Button is outside in a 
separate form. Clicking the button triggers a AjaxRequest on the form in which 
the table is. The idea is, that with this AjaxRequest the data of the table is 
mapped to the model (in this case only the infomation which row is selected). 
The AjaxResponse is parsed and, when everything is ok (a row is selected), an 
ActionRequest ist triggered, which leads to a new page. If the AjaxResponse is 
not ok, a error-message is displayed an the ActionRequest is not triggered.

If we don't rerender the ScollableDataTable after the AjaxRequest, everything 
works fine. If we rerender it, the Exception ist thrown. So parsing the 
AjaxResponse doesn't succeed. We traced it down to the iFrames which are used 
in the Header an the Footer of the Table:

<iframe class="dr-sdt-substrate" frameborder="0" 
id="personTrefferlisteContentForm:personTrefferlisteTable:hs" scrolling="no" 
src="javascript:''">
        <br />
</iframe>

I don't have a clue which function they have in the RichFaces-Component, but 
while Webtest (and HtmlUnit) tries to load the XMLHttpRequest.responseXML into 
the iFrame it assumes that it is HTML and constructs an HtmlPage while it 
should construct an XmlPage. Even after we patched this, Webtest tries to 
invoke javascript and the next Exception is thrown.

Regards,

Roland Würth (IT-Frankfurt)

Programm KonzernPerson - KP-FE/SL
Raum GH 02.45.096, Theodor-Heuss-Allee 80, D-60486 Frankfurt
Tel: +49 - 69 136  49668
mailto:[email protected]



-----Ursprüngliche Nachricht-----
Von: [email protected] [mailto:[email protected]] Im 
Auftrag von Marc Guillemot
Gesendet: Dienstag, 13. Oktober 2009 08:01
An: [email protected]
Betreff: Re: [Webtest] ClassCastException when clickingRichFaces-Button

Hallo Roland,

which WebTest version do you use? Looking at the stack trace it doesn't seem to 
be a recent build and this error should not occur with a recent build.

Gruss,
Marc.

Wuerth, Roland a écrit :
> Hi!
>  
> I already posted this problem to the HTMLUnit guys, but they told me 
> to ask here again. Below the conversation so far.
>  
> ----------------------------------------------------------------------
> --
> *Von:* Daniel Gredler [mailto:[email protected]]
> *Gesendet:* Montag, 5. Oktober 2009 18:11
> *An:* [email protected]
> *Betreff:* Re: [Htmlunit-user] ClasscastException when 
> clickingRichFaces-Button
> 
> Hi Roland,
> 
> This looks like a bug in
> com.canoo.webtest.engine.WebClientContext$CurrentWindowTracker.webWindowContentChanged().
> 
> They assume that the frame contains an HTML page. Can you contact the 
> WebTest guys about this?
> 
> Take care,
> 
> Daniel
> 
> 
> 
> On Mon, Oct 5, 2009 at 5:25 AM, Wuerth, Roland 
> <[email protected]
> <mailto:[email protected]>> wrote:
> 
>     Hi!
>      
>     I am using Webtest 3.0 with Htmlunit 2.4, but I'm getting this error
>     as well with the lates Webtest-Snapshot and Htmlunit 2.6.
>      
>     When I am clicking on an RichFaces 3.3.0.-Button an AjaxRequest is
>     triggered. While parsing the answer I am getting this error:
>      
>     java.util.concurrent.ExecutionException:
>     net.sourceforge.htmlunit.corejs.javascript.WrappedException: Wrapped
>     java.lang.ClassCastException:
>     com.gargoylesoftware.htmlunit.xml.XmlPage cannot be cast to
>     com.gargoylesoftware.htmlunit.html.HtmlPage
>     
> (http://localhost:9080/frontend/spring/a4j/g/3_3_0.GAorg.ajax4jsf.javascript.AjaxScript#86)
>       at java.util.concurrent.FutureTask$Sync.innerGet(Unknown Source)
>       at java.util.concurrent.FutureTask.get(Unknown Source)
>       at
>     
> com.gargoylesoftware.htmlunit.javascript.background.JavaScriptJobManagerImpl.waitForCompletion(JavaScriptJobManagerImpl.java:313)
>       at
>     
> com.gargoylesoftware.htmlunit.javascript.background.JavaScriptJobManagerImpl.waitForJobsStartingBefore(JavaScriptJobManagerImpl.java:258)
>       at
>     
> com.gargoylesoftware.htmlunit.WebClient.waitForBackgroundJavaScriptStartingBefore(WebClient.java:2103)
>       at com.canoo.webtest.steps.Step.execute(Step.java:109)
>       at
>     org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
>       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>       at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
>       at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
>       at java.lang.reflect.Method.invoke(Unknown Source)
>       at
>     
> org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105)
>       at org.apache.tools.ant.Task.perform(Task.java:348)
>       at
>     
> com.canoo.webtest.ant.TestStepSequence.executeSteps(TestStepSequence.java:43)
>       at
>     com.canoo.webtest.ant.TestStepSequence.doExecute(TestStepSequence.java:31)
>       at com.canoo.webtest.steps.Step.execute(Step.java:103)
>       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>       at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
>       at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
>       at java.lang.reflect.Method.invoke(Unknown Source)
>       at
>     
> org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105)
>       at org.apache.tools.ant.Task.perform(Task.java:348)
>       at
>     com.canoo.webtest.ant.WebtestTask.executeSteps(WebtestTask.java:236)
>       at com.canoo.webtest.ant.WebtestTask.execute(WebtestTask.java:208)
>       at
>     org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
>       at sun.reflect.GeneratedMethodAccessor2.invoke(Unknown Source)
>       at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
>       at java.lang.reflect.Method.invoke(Unknown Source)
>       at
>     
> org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105)
>       at org.apache.tools.ant.Task.perform(Task.java:348)
>       at org.apache.tools.ant.Target.execute(Target.java:357)
>       at org.apache.tools.ant.Target.performTasks(Target.java:385)
>       at
>     org.apache.tools.ant.Project.executeSortedTargets(Project.java:1329)
>       at
>     
> org.apache.tools.ant.helper.SingleCheckExecutor.executeTargets(SingleCheckExecutor.java:38)
>       at org.apache.tools.ant.Project.executeTargets(Project.java:1181)
>       at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:416)
>       at
>     org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
>       at sun.reflect.GeneratedMethodAccessor2.invoke(Unknown Source)
>       at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
>       at java.lang.reflect.Method.invoke(Unknown Source)
>       at
>     
> org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105)
>       at org.apache.tools.ant.Task.perform(Task.java:348)
>       at org.apache.tools.ant.Target.execute(Target.java:357)
>       at org.apache.tools.ant.Target.performTasks(Target.java:385)
>       at
>     org.apache.tools.ant.Project.executeSortedTargets(Project.java:1329)
>       at
>     
> org.apache.tools.ant.helper.SingleCheckExecutor.executeTargets(SingleCheckExecutor.java:38)
>       at org.apache.tools.ant.Project.executeTargets(Project.java:1181)
>       at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:416)
>       at
>     org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
>       at sun.reflect.GeneratedMethodAccessor2.invoke(Unknown Source)
>       at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
>       at java.lang.reflect.Method.invoke(Unknown Source)
>       at
>     
> org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105)
>       at org.apache.tools.ant.Task.perform(Task.java:348)
>       at org.apache.tools.ant.Target.execute(Target.java:357)
>       at org.apache.tools.ant.Target.performTasks(Target.java:385)
>       at
>     org.apache.tools.ant.Project.executeSortedTargets(Project.java:1329)
>       at
>     
> org.apache.tools.ant.helper.SingleCheckExecutor.executeTargets(SingleCheckExecutor.java:38)
>       at org.apache.tools.ant.Project.executeTargets(Project.java:1181)
>       at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:416)
>       at
>     org.apache.tools.ant.taskdefs.CallTarget.execute(CallTarget.java:105)
>       at
>     org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
>       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>       at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
>       at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
>       at java.lang.reflect.Method.invoke(Unknown Source)
>       at
>     
> org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105)
>       at org.apache.tools.ant.Task.perform(Task.java:348)
>       at org.apache.tools.ant.Target.execute(Target.java:357)
>       at org.apache.tools.ant.Target.performTasks(Target.java:385)
>       at
>     org.apache.tools.ant.Project.executeSortedTargets(Project.java:1329)
>       at org.apache.tools.ant.Project.executeTarget(Project.java:1298)
>       at
>     
> org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
>       at org.apache.tools.ant.Project.executeTargets(Project.java:1181)
>       at org.apache.tools.ant.Main.runBuild(Main.java:698)
>       at org.apache.tools.ant.Main.startAnt(Main.java:199)
>       at org.apache.tools.ant.launch.Launcher.run(Launcher.java:257)
>       at org.apache.tools.ant.launch.Launcher.main(Launcher.java:104)
>     Caused by:
>     net.sourceforge.htmlunit.corejs.javascript.WrappedException: Wrapped
>     java.lang.ClassCastException:
>     com.gargoylesoftware.htmlunit.xml.XmlPage cannot be cast to
>     com.gargoylesoftware.htmlunit.html.HtmlPage
>     
> (http://localhost:9080/frontend/spring/a4j/g/3_3_0.GAorg.ajax4jsf.javascript.AjaxScript#86)
>       at
>     
> net.sourceforge.htmlunit.corejs.javascript.Context.throwAsScriptRuntimeEx(Context.java:1789)
>       at
>     
> net.sourceforge.htmlunit.corejs.javascript.MemberBox.invoke(MemberBox.java:183)
>       at
>     
> net.sourceforge.htmlunit.corejs.javascript.ScriptableObject.getImpl(ScriptableObject.java:2253)
>       at
>     
> net.sourceforge.htmlunit.corejs.javascript.ScriptableObject.get(ScriptableObject.java:318)
>       at
>     
> com.gargoylesoftware.htmlunit.javascript.SimpleScriptable.get(SimpleScriptable.java:74)
>       at
>     
> com.gargoylesoftware.htmlunit.javascript.host.xml.XMLHttpRequest.get(XMLHttpRequest.java:497)
>       at
>     
> net.sourceforge.htmlunit.corejs.javascript.ScriptableObject.getProperty(ScriptableObject.java:1853)
>       at
>     
> net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.getObjectPropNoWarn(ScriptRuntime.java:1461)
>       at
>     
> net.sourceforge.htmlunit.corejs.javascript.Interpreter.interpretLoop(Interpreter.java:1379)
>       at
>     
> net.sourceforge.htmlunit.corejs.javascript.Interpreter.interpret(Interpreter.java:845)
>       at
>     
> net.sourceforge.htmlunit.corejs.javascript.InterpretedFunction.call(InterpretedFunction.java:164)
>       at
>     
> net.sourceforge.htmlunit.corejs.javascript.ContextFactory.doTopCall(ContextFactory.java:427)
>       at
>     
> com.gargoylesoftware.htmlunit.javascript.HtmlUnitContextFactory.doTopCall(HtmlUnitContextFactory.java:263)
>       at
>     
> net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3058)
>       at
>     
> net.sourceforge.htmlunit.corejs.javascript.InterpretedFunction.call(InterpretedFunction.java:162)
>       at
>     
> com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.callFunction(JavaScriptEngine.java:484)
>       at
>     
> com.gargoylesoftware.htmlunit.javascript.host.xml.XMLHttpRequest.setState(XMLHttpRequest.java:170)
>       at
>     
> com.gargoylesoftware.htmlunit.javascript.host.xml.XMLHttpRequest.doSend(XMLHttpRequest.java:448)
>       at
>     
> com.gargoylesoftware.htmlunit.javascript.host.xml.XMLHttpRequest.access$000(XMLHttpRequest.java:60)
>       at
>     
> com.gargoylesoftware.htmlunit.javascript.host.xml.XMLHttpRequest$1.run(XMLHttpRequest.java:391)
>       at
>     net.sourceforge.htmlunit.corejs.javascript.Context.call(Context.java:529)
>       at
>     
> net.sourceforge.htmlunit.corejs.javascript.ContextFactory.call(ContextFactory.java:536)
>       at
>     
> com.gargoylesoftware.htmlunit.javascript.host.xml.XMLHttpRequest$2.run(XMLHttpRequest.java:397)
>       at
>     
> com.gargoylesoftware.htmlunit.javascript.background.JavaScriptJobManagerImpl$ExecutingJobTracker.run(JavaScriptJobManagerImpl.java:98)
>       at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
>       at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
>       at java.util.concurrent.FutureTask.run(Unknown Source)
>       at
>     
> java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(Unknown
>     Source)
>       at
>     
> java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown
>     Source)
>       at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown
>     Source)
>       at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
>       at java.lang.Thread.run(Unknown Source)
>     Caused by: java.lang.ClassCastException:
>     com.gargoylesoftware.htmlunit.xml.XmlPage cannot be cast to
>     com.gargoylesoftware.htmlunit.html.HtmlPage
>       at
>     
> com.gargoylesoftware.htmlunit.html.FrameWindow.getEnclosingPage(FrameWindow.java:92)
>       at
>     
> com.canoo.webtest.engine.WebClientContext$CurrentWindowTracker.webWindowContentChanged(WebClientContext.java:111)
>       at
>     
> com.gargoylesoftware.htmlunit.WebClient.fireWindowContentChanged(WebClient.java:872)
>       at
>     
> com.gargoylesoftware.htmlunit.WebClient.loadWebResponseInto(WebClient.java:450)
>       at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:330)
>       at
>     com.gargoylesoftware.htmlunit.html.BaseFrame.<init>(BaseFrame.java:70)
>       at
>     
> com.gargoylesoftware.htmlunit.html.HtmlInlineFrame.<init>(HtmlInlineFrame.java:48)
>       at
>     
> com.gargoylesoftware.htmlunit.html.DefaultElementFactory.createElementNS(DefaultElementFactory.java:231)
>       at
>     com.gargoylesoftware.htmlunit.xml.XmlUtil.createFrom(XmlUtil.java:151)
>       at com.gargoylesoftware.htmlunit.xml.XmlUtil.copy(XmlUtil.java:205)
>       at com.gargoylesoftware.htmlunit.xml.XmlUtil.copy(XmlUtil.java:207)
>       at com.gargoylesoftware.htmlunit.xml.XmlUtil.copy(XmlUtil.java:207)
>       at com.gargoylesoftware.htmlunit.xml.XmlUtil.copy(XmlUtil.java:207)
>       at com.gargoylesoftware.htmlunit.xml.XmlUtil.copy(XmlUtil.java:207)
>       at com.gargoylesoftware.htmlunit.xml.XmlUtil.copy(XmlUtil.java:207)
>       at com.gargoylesoftware.htmlunit.xml.XmlUtil.copy(XmlUtil.java:207)
>       at com.gargoylesoftware.htmlunit.xml.XmlUtil.copy(XmlUtil.java:207)
>       at com.gargoylesoftware.htmlunit.xml.XmlUtil.copy(XmlUtil.java:207)
>       at com.gargoylesoftware.htmlunit.xml.XmlUtil.copy(XmlUtil.java:207)
>       at com.gargoylesoftware.htmlunit.xml.XmlUtil.copy(XmlUtil.java:207)
>       at com.gargoylesoftware.htmlunit.xml.XmlUtil.copy(XmlUtil.java:207)
>       at com.gargoylesoftware.htmlunit.xml.XmlUtil.copy(XmlUtil.java:207)
>       at com.gargoylesoftware.htmlunit.xml.XmlUtil.copy(XmlUtil.java:207)
>       at
>     com.gargoylesoftware.htmlunit.xml.XmlUtil.appendChild(XmlUtil.java:140)
>       at com.gargoylesoftware.htmlunit.xml.XmlPage.<init>(XmlPage.java:114)
>       at com.gargoylesoftware.htmlunit.xml.XmlPage.<init>(XmlPage.java:72)
>       at
>     
> com.gargoylesoftware.htmlunit.javascript.host.xml.XMLHttpRequest.jsxGet_responseXML(XMLHttpRequest.java:248)
>       at sun.reflect.GeneratedMethodAccessor37.invoke(Unknown Source)
>       at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
>       at java.lang.reflect.Method.invoke(Unknown Source)
>       at
>     
> net.sourceforge.htmlunit.corejs.javascript.MemberBox.invoke(MemberBox.java:161)
>       ... 30 more
>      
>     So far we were really happy with webtest an htmlunit, but
>     unfortunately this would be a showstopper for using it.
>      
>     I would appreciate if someone could help us with that problem.
>      
>     Regards
>     Roland Würth
> 
>  
>  


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

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

Reply via email to