By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,450 Members | 1,001 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,450 IT Pros & Developers. It's quick & easy.

Testing webpage with accordion object not pointing to all controls

P: 5
Hi there

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:

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
  1. function RunTests()
  2.     {
  3.         // Get working for the Principal Beneficiary first
  4.         alert('Run Tests for Test Rail Case C141697');
  6.         TestOptionalBenefits_Maternity();
  8.         TestOptionalBenefits_Dental();
  10.         alert('Test Run Completed');
  11.     }

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
  1. function TestOptionalBenefits_Maternity()
  2. {
  3.     alert("Test OptionalBenefits_Maternity started");
  5.     var maternityPrinMember = "12576_HasBenefit_0_False_100000";
  6.     var myObjmaternityPrinMember = document.getElementById(maternityPrinMember);
  8.     if (myObjmaternityPrinMember.disabled) {
  9.         alert('Member not eligible for Maternity benefit so, option disabled');
  10.     }
  11.     if (myObjmaternityPrinMember.checked) {
  12.         alert('User has selected Maternity benefit');
  13.     }
  14. }
Sep 6 '12 #1
Share this Question
Share on Google+
3 Replies

Expert Mod 5K+
P: 5,390
hmmm - how is the accordion created? are you sure the non-displayed nodes are already created in the dom or are they created on the fly when the corresponding accordion-panel is opened?

does firefox's firebug-console display any errors?

PS: when you add:
Expand|Select|Wrap|Line Numbers
  1. alert(myObjmaternityPrinMember);
into line 7 of the posted TestOptionalBenefits_Maternity-method-code - what does it show?
Sep 7 '12 #2

P: 5
Hi gits, thanks for your quick response.

The non-display nodes appear to be created when the user navigates to this page (Benefits) from the previous web form page (Apply) in the form. This is because in the previous page, the options the user selects affect how many rows of checkboxes the user can see. I.e. - if they select 5 people, then columns of checkboxes are shown for each row / criteria within each accordion pane. I could go into more details, but it would make this reply excessively long!

I've tried the page on firebug and it doesn't appear to show any errors but a few items are displayed in red like, for example:
- outer HTNL: "<a tabindex="-1" href="#">Dental</a>"
- path name: "/Apply/ReQuote"

Normally red text = errors but I don't think these are errors.

And when I add this alert box into the function of the code I posted, we get the message:
Sep 7 '12 #3

Expert Mod 5K+
P: 5,390
ok - so what does the alert say when you put:

Expand|Select|Wrap|Line Numbers
  1. alert(myObjmaternityPrinMember.disabled);
Sep 7 '12 #4

Post your reply

Sign in to post your reply or Sign up for a free account.