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(@id,'%s')]", id, id, id); } You have to be a little careful if you have a complex component that renders multiple fields with related ids, but on the whole, it works nicely. Robert On Jan 21, 2011, at 1/211:50 PM , Mark wrote: > 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 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. > > Is there a way for me to tell the BeanEditor what to use after the _ > for any field names? I think if I built the all the fields manually I > could probably get it to work, but I'd like to continue to use the > BeanEditor if possible. Is there another, better way to handle this > that I'm not thinking of? > > Thanks! > > Mark > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org > For additional commands, e-mail: users-h...@tapestry.apache.org > --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org