Hi Gible, Thanks for the feedback, there is probably something to improve here in order to have a more consistent behavior.
Please note that checkCheckbox will internally call assertCheckboxPresent so you can simplify your code by removing your call. [1] When there a re several forms in your page it's always a good thing to say on which one you are working, especially when identifying elements by name (as it is allowed to have duplicate name across forms in HTML). Regards, Julien [1] http://jwebunit.sourceforge.net/xref/net/sourceforge/jwebunit/junit/WebTester.html#2355 > >De : Gible Fog <gi...@gible.net> >À : jwebunit-users@lists.sourceforge.net >Envoyé le : Mer 5 janvier 2011, 23h 10min 59s >Objet : [JWebUnit-users] assertCheckboxPresent works but checkCheckbox fails > >This is just a note for others head-butting the same problem. > > >I have the following code in my test: > tester.assertCheckboxPresent("aname", "avalue"); > tester.checkCheckbox("aname", "avalue"); >The (first line) assertion works fine, but the second fails with the result: >"caused an ERROR: No checkbox with name [aname] and value [avalue] was found >in >the current form." >The issue is that assertCheckboxPresent >uses getTestingEngine().hasElementByXPath(..) to determine success whereas the >second iterates through the named input elements of the current form checking >each for type and value. This fails for me because I'm actually interested in >the /not first/ form of the page and unles you select a form first >with setWorkingForm(...) it only searchs the first form on the page. > > >My solution: > tester.setWorkingForm("aform"); > tester.assertCheckboxPresent("aname", "avalue"); > tester.checkCheckbox("aname", "avalue"); > > > > >regards >Gible ------------------------------------------------------------------------------ Learn how Oracle Real Application Clusters (RAC) One Node allows customers to consolidate database storage, standardize their database environment, and, should the need arise, upgrade to a full multi-node Oracle RAC database without downtime or disruption http://p.sf.net/sfu/oracle-sfdevnl _______________________________________________ JWebUnit-users mailing list JWebUnit-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jwebunit-users