Re: Ids for Testing BeanEditor in AjaxFormLoop

2011-01-21 Thread Mark
Ah ok I see. Thank you! On Fri, Jan 21, 2011 at 3:12 PM, Robert Zeigler wrote: > Yup: > > xpath=(//input[starts-with(@id,'firstName')])[2] > > Or as a utility function: > > String field(String id, int instance) { >   return String.format("xpath=(//input[starts-with(@id,'%s')])[%d]", id, > insta

Re: Ids for Testing BeanEditor in AjaxFormLoop

2011-01-21 Thread Robert Zeigler
Yup: xpath=(//input[starts-with(@id,'firstName')])[2] Or as a utility function: String field(String id, int instance) { return String.format("xpath=(//input[starts-with(@id,'%s')])[%d]", id, instance); } You can make that more general, as per my previous e-mail, by selecting an input or a

Re: Ids for Testing BeanEditor in AjaxFormLoop

2011-01-21 Thread Mark
On Fri, Jan 21, 2011 at 2:27 PM, Thiago H. de Paula Figueiredo wrote: > On Fri, 21 Jan 2011 17:50:30 -0200, Mark wrote: > >> However, I'm running into a problem with Selenium testing because the >> fields get ids like: firstName_12da594667a >> and of course it is different each time. This is caus

Re: Ids for Testing BeanEditor in AjaxFormLoop

2011-01-21 Thread Thiago H. de Paula Figueiredo
On Fri, 21 Jan 2011 17:50:30 -0200, Mark wrote: However, I'm running into a problem with Selenium testing because the fields get ids like: firstName_12da594667a and of course it is different each time. This is causing problems because I can't test it with Selenium. You can still do that. Just

Re: Ids for Testing BeanEditor in AjaxFormLoop

2011-01-21 Thread Robert Zeigler
What I usually do is use an xpath expression in selenium, something along the lines of: assertEquals("xyz",s.getValue(field("id"))); public static String field(String id) { return String.format("xpath=(//input[starts-with(@id,'%s')] | //select[starts-with(@id,'%s')] | //textarea[starts-with(

Ids for Testing BeanEditor in AjaxFormLoop

2011-01-21 Thread Mark
I have an AjaxFormLoop that contains a BeanEditor. The BeanEditor renders to fields. For example, firstName and lastName. This works just fine and I can add and remove rows. When I submit the enclosing form it all works perfectly. However, I'm running into a problem with Selenium testing becau