I'm doing some assertion tests on a page containing a number of checkboxes surrounded by an accordion object which someone else has given me.
If you don't know what this looks like; here's a picture of an example: http://bit.ly/RdDcKu
When you click on one of the panes to open it, the one that you had opened is closed, that's how it works.
Anyway, In the web page, I am calling a number of other test methods contained in a .js test class
The checkbox object is being picked up from the first pane in the accordion, but not in any of the other panes.
I know this because I have placed alert() popups in each of these other objects to assert whether the checkbox is being hit or not, and, only the first one is returning the 'option checked' or 'option unchecked' messages.
Has anyone else run into this problem; testing html web controls that are split over multiple div's or span's???
Just for reference, the code in my web page looks like this:
Expand|Select|Wrap|Line Numbers
- function RunTests()
- {
- // Get working for the Principal Beneficiary first
- alert('Run Tests for Test Rail Case C141697');
- TestOptionalBenefits_Maternity();
- TestOptionalBenefits_Dental();
- alert('Test Run Completed');
- }
And the way I am checking whether the checkbox is disabled or enabled and checked web pages looks like this:
Expand|Select|Wrap|Line Numbers
- function TestOptionalBenefits_Maternity()
- {
- alert("Test OptionalBenefits_Maternity started");
- var maternityPrinMember = "12576_HasBenefit_0_False_100000";
- var myObjmaternityPrinMember = document.getElementById(maternityPrinMember);
- if (myObjmaternityPrinMember.disabled) {
- alert('Member not eligible for Maternity benefit so, option disabled');
- }
- if (myObjmaternityPrinMember.checked) {
- alert('User has selected Maternity benefit');
- }
- }