I've submitted a bug. Thanks for looking into this.
http://sourceforge.net/tracker/index.php?func=detail&aid=1854975&group_id=47038&atid=448266
Marc Guillemot wrote:
>
> Hi,
>
> I've understood the problem and this needs to be fixed in HtmlUnit
> (please open a bug issue for that): a responseXML.getElementById('some
> id') is made on the XMLHttpRequest and this is not correctly supported
> by HtmlUnit. I wanted to fix it, but I didn't achieved to write in a
> short time a test working in my FF with getElementById on XMLDocument.
>
> Cheers,
> Marc.
> --
> Blog: http://mguillem.wordpress.com
>
>
> Valdis Rigdon wrote:
>> I've turned up debugging as you've suggested and I don't see anything
>> obvious. The first time 'XmlPage' comes up in the logs is on the
>> ClassCastException. I've written a quick test case against the Rich
>> Faces demo site and it fails like ours after clicking the 'Say Hello'
>> button which makes the AJAX request and updates the page.
>>
>> <webtest name="command-button">
>> <config host="livedemo.exadel.com"
>> resultpath="${wt.config.resultpath}" protocol="http"
>> basepath="richfaces-demo/richfaces/"
>> saveresponse="${config.saveResponse}" summary="true"
>> haltOnError="${config.halt}"
>> haltOnFailure="${config.halt}" errorProperty="webtest.error"
>> failureProperty="webtest.failure">
>> <header name="Cookie"
>> value="JSESSIONID=${sessioncookie}"/>
>> <option name="RedirectEnabled" value="true"/>
>> <option name="ThrowExceptionOnFailingStatusCode"
>> value="false"/>
>> <option name="ThrowExceptionOnScriptError" value="true"/>
>> </config>
>>
>> <steps>
>> <invoke url="commandButton.jsf"/>
>> <groovy>
>> assert
>> step.context.currentResponse.asText().contains('but produces an Ajax
>> request with a further partial page update')
>> </groovy>
>> <setInputField
>> xpath="id('j_id213')/table/tbody/tr/td[2]/input" value="Bob Dole"/>
>> <clickButton label="Say Hello"/>
>> <sleep seconds="10"/>
>> <groovy>
>> assert
>> step.context.currentResponse.asText().contains('Hello Bob Dole')
>> </groovy>
>> </steps>
>> </webtest>
>>
>> >>
>> 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 >> >> >> Relevant part of onreadystatechangehandler: >> >>
>>
>>>> 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);
>>>> }
>>>>
>>
>> >> >> 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? >> >
>> _______________________________________________ WebTest mailing list
>> [email protected] http://lists.canoo.com/mailman/listinfo/webtest
>> ------------------------------------------------------------------------
>> View this message in context: Re: ClassCastException: XmlPage
>> <http://www.nabble.com/ClassCastException%3A-XmlPage-tp14336206p14398902.html>
>> Sent from the WebTest mailing list archive
>> <http://www.nabble.com/WebTest-f14809.html> at Nabble.com.
>
>
> _______________________________________________
> WebTest mailing list
> [email protected]
> http://lists.canoo.com/mailman/listinfo/webtest
>
>
--
View this message in context:
http://www.nabble.com/ClassCastException%3A-XmlPage-tp14336206p14439276.html
Sent from the WebTest mailing list archive at Nabble.com.
_______________________________________________
WebTest mailing list
[email protected]
http://lists.canoo.com/mailman/listinfo/webtest