[prev in list] [next in list] [prev in thread] [next in thread] 

List:       htmlunit-user
Subject:    [Htmlunit-user] How to get current page when click() doesn't return
From:       Marcin Cetnarski <marcin.cetnarski () gmail ! com>
Date:       2009-12-11 9:45:56
Message-ID: 577c0a110912110145v2da3c737ib6251623aa3d0114 () mail ! gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


Hi,

I'm writing a test for my richfaces application. I use rich:panelMenu (and
panelMenuItems -
http://docs.jboss.org/richfaces/3.3.2.GA/en/devguide/html/rich_panelMenuItem.html)
for page navigation. PanelMenuItem component is repersented in html as <td>
tag, and this is a clickable element.

*<td style="width: 100%;" id="iconinvoices" class="dr-pmenu-group-self-label
rich-pmenu-item-label"><input type="hidden"
name="panelMenuActioninvoices"/>Invoices</td>*

This html element (id="iconinvoices") hasn't got onclick attribute but in
richfaces events are invoked by other JS code

var params = new Object();params['current'] = 'invoices';new
PanelMenuItem(ids,
params,{myId:'invoices',parentId:'j_id16'},{type:"item",onopen:"",onclose:""
*,event:"click"*,mode:"server",target:"",disabled:false,target:"",name:"invoices"},{},new
 Array("dr-pmenu-hovered-element","rich-pmenu-hovered-element"),1,false,true,false,"A4 \
J.AJAX.Submit('_viewRoot',null,event,{'similarityGroupingId':'invoices','parameters':{'current':'invoices','invoices':'invoices'}
 ,'actionUrl':'/web\x2Dcompany/*pages/invoiceslist.jsf'*}
)","","left","/web-company/a4j/g/3_3_1.GAorg.richfaces.renderkit.html.iconimages.Panel \
MenuIconGrid/DATB/eAFLP78AAAN2Adc_.jsf","/web-company/a4j/g/3_3_1.GAorg.richfaces.renderkit.html.iconimages.PanelMenuIconGrid/DATB/eAFLP78AAAN2Adc_.jsf"
 ,""
,"/web-company/a4j/g/3_3_1.GAorg.richfaces.renderkit.html.iconimages.PanelMenuIconSpacer/DATB/eAFLP78AAAN2Adc_.jsf");



PanelMenuItem class can be found here -
http://anonsvn.jboss.org/repos/richfaces/tags/3.3.1.GA/ui/panelmenu/src/main/resources/org/richfaces/renderkit/html/scripts/panelMenu.js


so after click on id="iconinvoices" elements new page is loaded.

In HtmlElements class method click() is following code


        final ScriptResult scriptResult = fireEvent(event);
        final Page currentPage;
        if (scriptResult == null) {
            currentPage = page;
        }
        else {
            currentPage = scriptResult.getNewPage();
        }

In my case, scriptResult is always null.

My, question is how to receive a reference to new current page and test
panelMenu navigation case?

-- 
Best regards,
Marcin Cetnarski


[Attachment #5 (text/html)]

Hi,<br><br>I&#39;m writing a test for my richfaces application. I use rich:panelMenu \
(and panelMenuItems - <a \
href="http://docs.jboss.org/richfaces/3.3.2.GA/en/devguide/html/rich_panelMenuItem.htm \
l">http://docs.jboss.org/richfaces/3.3.2.GA/en/devguide/html/rich_panelMenuItem.html</a>) \
for page navigation. PanelMenuItem component is repersented in html as &lt;td&gt; \
tag, and this is a clickable element.<br> <br><i>&lt;td style=&quot;width: \
100%;&quot; id=&quot;iconinvoices&quot; class=&quot;dr-pmenu-group-self-label \
rich-pmenu-item-label&quot;&gt;&lt;input type=&quot;hidden&quot; \
name=&quot;panelMenuActioninvoices&quot;/&gt;Invoices&lt;/td&gt;</i><br> <br>This \
html element (id=&quot;iconinvoices&quot;) hasn&#39;t got onclick attribute but in \
richfaces events are invoked by other JS code<br><br><span class="sourceRowText">var \
params = new Object();params[&#39;current&#39;] = &#39;invoices&#39;;new \
PanelMenuItem(ids, params,{myId:&#39;invoices&#39;,parentId:&#39;j_id16&#39;},{type:&q \
uot;item&quot;,onopen:&quot;&quot;,onclose:&quot;&quot;<b>,event:&quot;click&quot;</b> \
,mode:&quot;server&quot;,target:&quot;&quot;,disabled:false,target:&quot;&quot;,name:&quot;invoices&quot;},{},new
 Array(&quot;dr-pmenu-hovered-element&quot;,&quot;rich-pmenu-hovered-element&quot;),1, \
false,true,false,&quot;A4J.AJAX.Submit(&#39;_viewRoot&#39;,null,event,{&#39;similarity \
GroupingId&#39;:&#39;invoices&#39;,&#39;parameters&#39;:{&#39;current&#39;:&#39;invoices&#39;,&#39;invoices&#39;:&#39;invoices&#39;}
 ,&#39;actionUrl&#39;:&#39;/web\x2Dcompany/<b>pages/invoiceslist.jsf&#39;</b>}
)&quot;,&quot;&quot;,&quot;left&quot;,&quot;/web-company/a4j/g/3_3_1.GAorg.richfaces.r \
enderkit.html.iconimages.PanelMenuIconGrid/DATB/eAFLP78AAAN2Adc_.jsf&quot;,&quot;/web- \
company/a4j/g/3_3_1.GAorg.richfaces.renderkit.html.iconimages.PanelMenuIconGrid/DATB/eAFLP78AAAN2Adc_.jsf&quot;
 ,&quot;&quot;
,&quot;/web-company/a4j/g/3_3_1.GAorg.richfaces.renderkit.html.iconimages.PanelMenuIconSpacer/DATB/eAFLP78AAAN2Adc_.jsf&quot;);
 </span><br clear="all"><br><span class="sourceRowText">PanelMenuItem class can be \
found here - </span><a \
href="http://anonsvn.jboss.org/repos/richfaces/tags/3.3.1.GA/ui/panelmenu/src/main/res \
ources/org/richfaces/renderkit/html/scripts/panelMenu.js">http://anonsvn.jboss.org/rep \
os/richfaces/tags/3.3.1.GA/ui/panelmenu/src/main/resources/org/richfaces/renderkit/html/scripts/panelMenu.js</a><br>
 <br>so after click on id=&quot;iconinvoices&quot; elements new page is \
loaded.<br><br>In HtmlElements class method click() is following code<br><br><br>     \
final ScriptResult scriptResult = fireEvent(event);<br>        final Page \
currentPage;<br>  if (scriptResult == null) {<br>            currentPage = page;<br>  \
}<br>        else {<br>            currentPage = scriptResult.getNewPage();<br>       \
}<br><br>In my case, scriptResult is always null.<br> <br>My, question is how to \
receive a reference to new current page and test panelMenu navigation case?<br><br>-- \
<br>Best regards,<br>Marcin Cetnarski<br>



------------------------------------------------------------------------------
Return on Information:
Google Enterprise Search pays you back
Get the facts.
http://p.sf.net/sfu/google-dev2dev


_______________________________________________
Htmlunit-user mailing list
Htmlunit-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/htmlunit-user


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic