[JWebUnit-users] assertCheckboxPresent works but checkCheckbox fails
Brought to you by:
henryju
From: Gible F. <gi...@gi...> - 2011-01-05 23:12:25
|
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 |