<HTML><BODY style="word-wrap: break-word; -khtml-nbsp-mode: space; -khtml-line-break: after-white-space; ">Hi Stan,<DIV><BR class="khtml-block-placeholder"></DIV><DIV>Thanks for the quick response. I've tried commenting out the two lines you indicated, but still no luck. HttpUnit doesn't seem to be able to cope with the JavaScript that is generated for the commandLink. The error I get is:</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">com.meterware.httpunit.ScriptException: Event 'if(typeof jsfcljs == 'function'){jsfcljs(document.forms['form'],'form:link,form:link','');}return false' failed: TypeError: undefined is not a function. (httpunit; )</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">at com.meterware.httpunit.javascript.JavaScript$JavaScriptEngine.handleScriptException(JavaScript.java:202)</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">at com.meterware.httpunit.javascript.JavaScript$JavaScriptEngine.performEvent(JavaScript.java:175)</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">at com.meterware.httpunit.scripting.ScriptableDelegate.doEvent(ScriptableDelegate.java:56)</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">at com.meterware.httpunit.WebRequestSource.submitRequest(WebRequestSource.java:232)</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">at com.meterware.httpunit.WebLink.click(WebLink.java:98)</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><BR class="khtml-block-placeholder"></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">I'm using JBoss 4.2.0GA, that in turn uses the JSF reference implementation, so that may explain why this fix is working for you but not for me.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><BR class="khtml-block-placeholder"></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">The HTML/Javascript that is generated for link.jsp is:</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><BR class="khtml-block-placeholder"></DIV><DIV>&lt;?xml version="1.0" encoding="utf-8"?&gt;</DIV><DIV>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"</DIV><DIV><SPAN class="Apple-tab-span" style="white-space:pre">        </SPAN> "<A href="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd</A>"&gt;</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>&lt;html xmlns="<A href="http://www.w3.org/1999/xhtml">http://www.w3.org/1999/xhtml</A>"&gt;</DIV><DIV>&lt;head&gt;</DIV><DIV><SPAN class="Apple-tab-span" style="white-space:pre">        </SPAN>&lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8" /&gt;</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV><SPAN class="Apple-tab-span" style="white-space:pre">        </SPAN>&lt;title&gt;Link test&lt;/title&gt;</DIV><DIV>&lt;/head&gt;</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>&lt;body&gt;</DIV><DIV><SPAN class="Apple-tab-span" style="white-space:pre">        </SPAN>&lt;form id="j_id_jsp_918822224_1" </DIV><DIV><SPAN class="Apple-tab-span" style="white-space:pre">                        </SPAN>name="j_id_jsp_918822224_1" </DIV><DIV><SPAN class="Apple-tab-span" style="white-space:pre">                        </SPAN>method="post" action="/JsfTest/link.faces" enctype="application/x-www-form-urlencoded"&gt;</DIV><DIV><SPAN class="Apple-tab-span" style="white-space:pre">                </SPAN>&lt;input type="hidden" name="j_id_jsp_918822224_1" value="j_id_jsp_918822224_1" /&gt; </DIV><DIV><SPAN class="Apple-tab-span" style="white-space:pre">                </SPAN>&lt;script type="text/javascript" language="Javascript"&gt;</DIV><DIV><SPAN class="Apple-tab-span" style="white-space:pre">                </SPAN>//&lt;![CDATA[</DIV><DIV><SPAN class="Apple-tab-span" style="white-space:pre">                </SPAN>function dpf(f) {</DIV><DIV><SPAN class="Apple-tab-span" style="white-space:pre">                        </SPAN>var adp = f.adp;</DIV><DIV><SPAN class="Apple-tab-span" style="white-space:pre">                        </SPAN>if (adp != null) {</DIV><DIV><SPAN class="Apple-tab-span" style="white-space:pre">                                </SPAN>for (var i = 0;i &lt; adp.length;i++) {</DIV><DIV><SPAN class="Apple-tab-span" style="white-space:pre">                                        </SPAN>f.removeChild(adp[i]);</DIV><DIV><SPAN class="Apple-tab-span" style="white-space:pre">                                </SPAN>}</DIV><DIV><SPAN class="Apple-tab-span" style="white-space:pre">                        </SPAN>}</DIV><DIV><SPAN class="Apple-tab-span" style="white-space:pre">                </SPAN>};</DIV><DIV><SPAN class="Apple-tab-span" style="white-space:pre">                </SPAN>function apf(f, pvp) {</DIV><DIV><SPAN class="Apple-tab-span" style="white-space:pre">                        </SPAN>var adp = new Array();</DIV><DIV><SPAN class="Apple-tab-span" style="white-space:pre">                        </SPAN>f.adp = adp;</DIV><DIV><SPAN class="Apple-tab-span" style="white-space:pre">                        </SPAN>var ps = pvp.split(',');</DIV><DIV><SPAN class="Apple-tab-span" style="white-space:pre">                        </SPAN>for (var i = 0,ii = 0;i &lt; ps.length;i++,ii++) {</DIV><DIV><SPAN class="Apple-tab-span" style="white-space:pre">                                </SPAN>var p = document.createElement("input");</DIV><DIV><SPAN class="Apple-tab-span" style="white-space:pre">                                </SPAN>p.type = "hidden";</DIV><DIV><SPAN class="Apple-tab-span" style="white-space:pre">                                </SPAN>p.name = ps[i];</DIV><DIV><SPAN class="Apple-tab-span" style="white-space:pre">                                </SPAN>p.value = ps[i + 1];</DIV><DIV><SPAN class="Apple-tab-span" style="white-space:pre">                                </SPAN>f.appendChild(p);</DIV><DIV><SPAN class="Apple-tab-span" style="white-space:pre">                                </SPAN>adp[ii] = p;i += 1;</DIV><DIV><SPAN class="Apple-tab-span" style="white-space:pre">                        </SPAN>}</DIV><DIV><SPAN class="Apple-tab-span" style="white-space:pre">                </SPAN>};</DIV><DIV><SPAN class="Apple-tab-span" style="white-space:pre">                </SPAN>function jsfcljs(f, pvp, t) {</DIV><DIV><SPAN class="Apple-tab-span" style="white-space:pre">                        </SPAN>apf(f, pvp);</DIV><DIV><SPAN class="Apple-tab-span" style="white-space:pre">                        </SPAN>if (t) {</DIV><DIV><SPAN class="Apple-tab-span" style="white-space:pre">                                </SPAN>f.target = t;</DIV><DIV><SPAN class="Apple-tab-span" style="white-space:pre">                        </SPAN>}</DIV><DIV><SPAN class="Apple-tab-span" style="white-space:pre">                        </SPAN>f.submit();</DIV><DIV><SPAN class="Apple-tab-span" style="white-space:pre">                        </SPAN>dpf(f);</DIV><DIV><SPAN class="Apple-tab-span" style="white-space:pre">                </SPAN>};</DIV><DIV>//]]&gt;</DIV><DIV>&lt;/script&gt; </DIV><DIV><SPAN class="Apple-tab-span" style="white-space:pre">                </SPAN>&lt;a id="j_id_jsp_918822224_1:link" href="#" </DIV><DIV><SPAN class="Apple-tab-span" style="white-space:pre">                        </SPAN>onclick="if(typeof jsfcljs == 'function'){jsfcljs(document.forms['j_id_jsp_918822224_1'],'j_id_jsp_918822224_1:link,j_id_jsp_918822224_1:link','');}return false" name="j_id_jsp_918822224_1:link"&gt;click me&lt;/a&gt;</DIV><DIV><SPAN class="Apple-tab-span" style="white-space:pre">                        </SPAN>&lt;input type="hidden" name="javax.faces.ViewState" id="javax.faces.ViewState" value="j_id1:j_id2" /&gt;</DIV><DIV><SPAN class="Apple-tab-span" style="white-space:pre">        </SPAN>&lt;/form&gt;</DIV><DIV>&lt;/body&gt;</DIV><DIV>&lt;/html&gt;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><BR class="khtml-block-placeholder"></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">My JavaScript knowledge is not very deep, so I'm having trouble understanding the error message from HttpUnit.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><BR class="khtml-block-placeholder"></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">Regards,</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">Pieter.</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV><BR><DIV><DIV>Op 8-aug-2007, om 2:41 heeft Stan Silvert het volgende geschreven:</DIV><BR class="Apple-interchange-newline"><BLOCKQUOTE type="cite"><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">Hi Pieter,</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><BR></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">The fix is taking a little longer than I expected.<SPAN class="Apple-converted-space">  </SPAN>If you comment out two lines of code in WebConversationFactory then the client.clickLink() on a commandLink will work (at least with MyFaces 1.1).<SPAN class="Apple-converted-space">  </SPAN>The two lines are:</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><BR></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">HTMLParserFactory.useJTidyParser();</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">HttpUnitOptions.setScriptingEnabled(false);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><BR></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">The problem is, that will break AJAX support.<SPAN class="Apple-converted-space">  </SPAN>So I'm not sure what the final solution will be.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><BR></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">Stan</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><BR></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">Pieter Kuijpers wrote:</DIV> <BLOCKQUOTE type="cite"><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">I'm trying to test a commandLink in a page with ClientFacade.clickLink, but this does not seem to be working.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">link.jsp:</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">&lt;html xmlns="<A href="http://www.w3.org/1999/xhtml">http://www.w3.org/1999/xhtml</A>"&gt;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">&lt;%@ taglib uri="<A href="http://java.sun.com/jsf/core">http://java.sun.com/jsf/core</A>" prefix="f"%&gt;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">&lt;%@ taglib uri="<A href="http://java.sun.com/jsf/html">http://java.sun.com/jsf/html</A>" prefix="h"%&gt;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">&lt;f:view&gt;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">&lt;head&gt;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">&lt;meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /&gt;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">&lt;title&gt;Link test&lt;/title&gt;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">&lt;/head&gt;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">&lt;body&gt;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">&lt;h:form&gt;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">&lt;h:commandLink id="link" value="click me" action="target"/&gt;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">&lt;/h:form&gt;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">&lt;/body&gt;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">&lt;/f:view&gt;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">&lt;/html&gt;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">target.jsp:</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">&lt;html xmlns="<A href="http://www.w3.org/1999/xhtml">http://www.w3.org/1999/xhtml</A>"&gt;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">&lt;head&gt;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">&lt;meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /&gt;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">&lt;title&gt;Link test successful&lt;/title&gt;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">&lt;/head&gt;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">&lt;body&gt;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">Success.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">&lt;/body&gt;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">&lt;/html&gt;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">Test code:</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">public class LinkTest extends TestCase {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><SPAN class="Apple-converted-space">    </SPAN>public void testClickLink() throws Exception {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><SPAN class="Apple-converted-space">        </SPAN>ClientFacade client = new ClientFacade("/link.faces");</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><SPAN class="Apple-converted-space">        </SPAN>client.clickLink("link");</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><SPAN class="Apple-converted-space">        </SPAN>assertEquals("Link test successful", client.getWebResponse().getTitle());</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><SPAN class="Apple-converted-space">    </SPAN>}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">The HTML that is returned using client.getWebResponse().getText is that of link.jsp. When I try the same test by hand, it is working OK.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">How is this supposed to work?</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">Thanks,</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">Pieter Kuijpers.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">------------------------------------------------------------------------</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">_______________________________________________</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">jsfunit-dev mailing list</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><A href="mailto:jsfunit-dev@lists.jboss.org">jsfunit-dev@lists.jboss.org</A></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><A href="https://lists.jboss.org/mailman/listinfo/jsfunit-dev">https://lists.jboss.org/mailman/listinfo/jsfunit-dev</A></DIV> </BLOCKQUOTE><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><BR></DIV> </BLOCKQUOTE></DIV><BR><DIV> <SPAN class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><DIV id="sig" style="font-family: Arial;color: #003366;"><SPAN class="Apple-style-span" style="color: rgb(0, 51, 102); font-family: Arial; ">--</SPAN><BR style="color: rgb(0, 51, 102); font-family: Arial; "><SPAN class="Apple-style-span" style="color: rgb(0, 51, 102); font-family: Arial; "> </SPAN><FONT class="Apple-style-span" color="#000000" face="Helvetica"><IMG src="cid:6CEAC134-EABB-4E89-B280-216F40B14B4F@local"><SPAN class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><DIV id="sig" style="font-family: Arial;color: #003366;"><SPAN style="color: #ff9900;font-weight: bold;font-style: normal;font-size: x-large;; font-family: Arial; font-size: 18px; "><SPAN class="Apple-style-span" style="color: rgb(255, 153, 0); font-family: Arial; font-size: 18px; font-weight: bold; ">Pieter Kuijpers</SPAN></SPAN><BR style="color: rgb(0, 51, 102); font-family: Arial; "><SPAN class="Apple-style-span" style="color: rgb(0, 51, 102); font-family: Arial; ">Senior software engineer </SPAN><B style="color: rgb(0, 51, 102); font-family: Arial; font-weight: bold; "><SPAN class="Apple-style-span" style="color: rgb(0, 51, 102); font-family: Arial; font-weight: bold; ">luminis</SPAN></B><SPAN class="Apple-style-span" style="color: rgb(0, 51, 102); font-family: Arial; ">®</SPAN><BR style="color: rgb(0, 51, 102); font-family: Arial; "><SPAN class="Apple-style-span" style="color: rgb(0, 51, 102); font-family: Arial; ">-------------------------------------------------</SPAN><BR style="color: rgb(0, 51, 102); font-family: Arial; "><SPAN class="Apple-style-span" style="color: rgb(0, 51, 102); font-family: Arial; ">06 174 185 34</SPAN><BR style="color: rgb(0, 51, 102); font-family: Arial; "><SPAN class="Apple-style-span" style="color: rgb(0, 51, 102); font-family: Arial; "><A href="mailto:pieter.kuijpers@luminis.nl">pieter.kuijpers@luminis.nl</A></SPAN><BR style="color: rgb(0, 51, 102); font-family: Arial; "><A href="http://www.luminis.nl/"><SPAN class="Apple-style-span" style="color: rgb(0, 0, 238); font-family: Arial; -khtml-text-decorations-in-effect: underline; ">www.luminis.nl</SPAN></A><BR style="color: rgb(0, 51, 102); font-family: Arial; "><SPAN class="Apple-style-span" style="color: rgb(0, 51, 102); font-family: Arial; ">-------------------------------------------------</SPAN><DIV style="color: rgb(0, 51, 102); font-family: Arial; "><BR class="khtml-block-placeholder"></DIV></DIV><BR class="Apple-interchange-newline"></SPAN> </FONT></DIV><FONT class="Apple-style-span" color="#000000" face="Helvetica"></FONT></SPAN></DIV><BR></DIV></BODY></HTML>