This content has been marked as final.
Show 26 replies
-
15. Re: Wrapped java.lang.RuntimeException: Could not retrieve X
bgregory Jun 17, 2008 7:58 PM (in response to bgregory)You make an interesting case; I'll try it and let you know.
-
16. Re: Wrapped java.lang.RuntimeException: Could not retrieve X
bgregory Jun 17, 2008 8:20 PM (in response to bgregory)If it isn't one thing, its another. Here's my code:
WebClientSpec wcSpec = new WebClientSpec(loginUrl,BrowserVersion.INTERNET_EXPLORER_6_0); FormAuthenticationStrategy formStrategy = new FormAuthenticationStrategy(userName, password); formStrategy.setSubmitComponent("submitButton"); wcSpec.setInitialRequestStrategy(formStrategy); JSFSession jsfSession = new JSFSession(wcSpec); JSFClientSession client = jsfSession.getJSFClientSession(); JSFServerSession server = jsfSession.getJSFServerSession();
Here's the exception:java.lang.ClassCastException: com.gargoylesoftware.htmlunit.html.HtmlScript at com.gargoylesoftware.htmlunit.html.HtmlScript.printChildrenAsXml(HtmlScript.java:406) at com.gargoylesoftware.htmlunit.html.HtmlElement.printXml(HtmlElement.java:842) at com.gargoylesoftware.htmlunit.html.DomNode.asXml(DomNode.java:732) at com.gargoylesoftware.htmlunit.html.HtmlScript.onAllChildrenAddedToPage(HtmlScript.java:199) at com.gargoylesoftware.htmlunit.html.HTMLParser$HtmlUnitDOMBuilder.endElement(HTMLParser.java:496) at org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown Source) at com.gargoylesoftware.htmlunit.html.HTMLParser$HtmlUnitDOMBuilder.endElement(HTMLParser.java:466) at org.cyberneko.html.filters.DefaultFilter.endElement(DefaultFilter.java:210) at org.cyberneko.html.filters.NamespaceBinder.endElement(NamespaceBinder.java:329) at org.cyberneko.html.HTMLTagBalancer.callEndElement(HTMLTagBalancer.java:971) at org.cyberneko.html.HTMLTagBalancer.endElement(HTMLTagBalancer.java:874) at org.cyberneko.html.HTMLScanner$ContentScanner.scanEndElement(HTMLScanner.java:2736) at org.cyberneko.html.HTMLScanner$ContentScanner.scan(HTMLScanner.java:1937) at org.cyberneko.html.HTMLScanner.scanDocument(HTMLScanner.java:877) at org.cyberneko.html.HTMLConfiguration.parse(HTMLConfiguration.java:495) at org.cyberneko.html.HTMLConfiguration.parse(HTMLConfiguration.java:448) at org.apache.xerces.parsers.XMLParser.parse(Unknown Source) at com.gargoylesoftware.htmlunit.html.HTMLParser$HtmlUnitDOMBuilder.parse(HTMLParser.java:634) at com.gargoylesoftware.htmlunit.html.HTMLParser.parse(HTMLParser.java:235) at com.gargoylesoftware.htmlunit.DefaultPageCreator.createHtmlPage(DefaultPageCreator.java:127) at com.gargoylesoftware.htmlunit.DefaultPageCreator.createPage(DefaultPageCreator.java:101) at com.gargoylesoftware.htmlunit.WebClient.loadWebResponseInto(WebClient.java:428) at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:337) at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:360) at com.gargoylesoftware.htmlunit.html.HtmlForm.submit(HtmlForm.java:167) at com.gargoylesoftware.htmlunit.html.HtmlSubmitInput.doClickAction(HtmlSubmitInput.java:78) at com.gargoylesoftware.htmlunit.html.ClickableElement.click(ClickableElement.java:132) at com.gargoylesoftware.htmlunit.html.ClickableElement.click(ClickableElement.java:93) at com.gargoylesoftware.htmlunit.html.ClickableElement.click(ClickableElement.java:72) at org.jboss.jsfunit.framework.FormAuthenticationStrategy.clickSubmitComponent(FormAuthenticationStrategy.java:105) at org.jboss.jsfunit.framework.FormAuthenticationStrategy.doInitialRequest(FormAuthenticationStrategy.java:93) at org.jboss.jsfunit.framework.WebClientSpec.doInitialRequest(WebClientSpec.java:222) at org.jboss.jsfunit.jsfsession.JSFSession.<init>(JSFSession.java:78) ...
My simple tests that I tried before didn't have to authentication.
This works fine without the IE6 browser type. -
17. Re: Wrapped java.lang.RuntimeException: Could not retrieve X
ssilvert Jun 17, 2008 10:10 PM (in response to bgregory)"bgregory" wrote:
You make an interesting case; I'll try it and let you know.
I already tried it. It won't work if the <f:selectItems> is backed by a Map. I haven't tried an array or Collection of SelectItem objects. I'll have to come up with something new or put the old method back in. I want the API to allow you to write the test just from looking at your markup (if possible). But that's not always possible.
Stan -
18. Re: Wrapped java.lang.RuntimeException: Could not retrieve X
ssilvert Jun 17, 2008 10:13 PM (in response to bgregory)"bgregory" wrote:
If it isn't one thing, its another. Here's my code:
My simple tests that I tried before didn't have to authentication.
This works fine without the IE6 browser type.
So you are saying that one test breaks for IE6 and another breaks for FF?
Stan -
19. Re: Wrapped java.lang.RuntimeException: Could not retrieve X
bgregory Jun 18, 2008 6:33 AM (in response to bgregory)Essentially, yeah. The form login breaks w/ IE6, but all of the ClassCastExceptions were w/ FF. Of course, since I can't get past the form login on IE6, I don't really know if there are other problems.
-
20. Re: Wrapped java.lang.RuntimeException: Could not retrieve X
bgregory Jun 18, 2008 6:36 AM (in response to bgregory)BTW, This is what I'm using as a drop-in for setSelected().
public void selectByValue(String controlId, String value) throws IOException { HtmlSelect htmlSelect = (HtmlSelect)client.getElement(controlId); HtmlOption htmlOption = htmlSelect.getOptionByValue(value); htmlOption.click(); }
-
21. Re: Wrapped java.lang.RuntimeException: Could not retrieve X
ssilvert Jun 18, 2008 10:56 AM (in response to bgregory)"bgregory" wrote:
Essentially, yeah. The form login breaks w/ IE6, but all of the ClassCastExceptions were w/ FF. Of course, since I can't get past the form login on IE6, I don't really know if there are other problems.
I'm grasping at straws here, but maybe you could try BrowserVersion.INTERNET_EXPLORER_7_0.
As soon as I can I'll try to get these problems reported to the HtmlUnit folks.
Stan -
22. Re: Wrapped java.lang.RuntimeException: Could not retrieve X
ssilvert Jun 18, 2008 10:06 PM (in response to bgregory)"bgregory" wrote:
Here is the form I used:<a4j:form> <h:panelGrid id="reDrawThisSection"> <h:outputText value="#{backingBean.value}"/> <a4j:commandButton id="commandButton" reRender="reDrawThisSection" value="Refresh"/> </h:panelGrid> </a4j:form>
and my test code:public void testAjaxButton() throws IOException { JSFSession jsfSession = new JSFSession("/refresh.faces"); JSFClientSession client = jsfSession.getJSFClientSession(); client.click("commandButton"); }
I filed an HtmlUnit bug report for this problem here:
https://sourceforge.net/tracker/?func=detail&atid=448266&aid=1997110&group_id=47038
Stan -
23. Re: Wrapped java.lang.RuntimeException: Could not retrieve X
jinpsu Jun 19, 2008 9:52 AM (in response to bgregory)"stan.silvert@jboss.com" wrote:
Your datatable problem could be related. I have to distinguish between an a4j request that changed the view and one that didn't (like a resource request). I need to take a closer look at that.
Hey Stan, did you ever get a chance to look at this code? We have several test cases that are exhibiting this symptom when reRender'ing a rich:dataTable.
Thanks.
Justin. -
24. Re: Wrapped java.lang.RuntimeException: Could not retrieve X
ssilvert Jun 19, 2008 11:08 AM (in response to bgregory)"jinpsu" wrote:
"stan.silvert@jboss.com" wrote:
Your datatable problem could be related. I have to distinguish between an a4j request that changed the view and one that didn't (like a resource request). I need to take a closer look at that.
Hey Stan, did you ever get a chance to look at this code? We have several test cases that are exhibiting this symptom when reRender'ing a rich:dataTable.
Thanks.
Justin.
Which symptom? There are a few problems mentioned in this thread so it's hard to keep up. I've filed a bug against HtmlUnit for one of them.
Can you start a new thread to talk about your specific problem?
Stan -
25. Re: Wrapped java.lang.RuntimeException: Could not retrieve X
jinpsu Jun 19, 2008 11:37 AM (in response to bgregory)"stan.silvert@jboss.com" wrote:
Which symptom? There are a few problems mentioned in this thread so it's hard to keep up. I've filed a bug against HtmlUnit for one of them.
Can you start a new thread to talk about your specific problem?
Stan
Done :)
Justin. -
26. Re: Wrapped java.lang.RuntimeException: Could not retrieve X
ssilvert Jun 19, 2008 7:12 PM (in response to bgregory)"stan.silvert@jboss.com" wrote:
"bgregory" wrote:
Here is the form I used:<a4j:form> <h:panelGrid id="reDrawThisSection"> <h:outputText value="#{backingBean.value}"/> <a4j:commandButton id="commandButton" reRender="reDrawThisSection" value="Refresh"/> </h:panelGrid> </a4j:form>
and my test code:public void testAjaxButton() throws IOException { JSFSession jsfSession = new JSFSession("/refresh.faces"); JSFClientSession client = jsfSession.getJSFClientSession(); client.click("commandButton"); }
I filed an HtmlUnit bug report for this problem here:
https://sourceforge.net/tracker/?func=detail&atid=448266&aid=1997110&group_id=47038
Stan
I just verified that this one is now fixed in HtmlUnit SVN.
Stan