[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'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 <td> \
tag, and this is a clickable element.<br> <br><i><td style="width: \
100%;" id="iconinvoices" class="dr-pmenu-group-self-label \
rich-pmenu-item-label"><input type="hidden" \
name="panelMenuActioninvoices"/>Invoices</td></i><br> <br>This \
html element (id="iconinvoices") hasn't got onclick attribute but in \
richfaces events are invoked by other JS code<br><br><span class="sourceRowText">var \
params = new Object();params['current'] = 'invoices';new \
PanelMenuItem(ids, params,{myId:'invoices',parentId:'j_id16'},{type:&q \
uot;item",onopen:"",onclose:""<b>,event:"click"</b> \
,mode:"server",target:"",disabled:false,target:"",name:"invoices"},{},new
Array("dr-pmenu-hovered-element","rich-pmenu-hovered-element"),1, \
false,true,false,"A4J.AJAX.Submit('_viewRoot',null,event,{'similarity \
GroupingId':'invoices','parameters':{'current':'invoices','invoices':'invoices'}
,'actionUrl':'/web\x2Dcompany/<b>pages/invoiceslist.jsf'</b>}
)","","left","/web-company/a4j/g/3_3_1.GAorg.richfaces.r \
enderkit.html.iconimages.PanelMenuIconGrid/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");
</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="iconinvoices" 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