Hi, Thank you for sharing your knowledge.
I have a doubt, parentNode property is returning only three objects, but getElementsByName method is returning six objects in the page, http://www.javascripter.net/faq/disablin.htm Do not check any radio button, then the result is displayed as, (I guess, it is returning first three objects) Value: download Selected: False IsDisabled: False Value: regular mail Selected: False IsDisabled: False Value: courier Selected: False IsDisabled: False (**) Check 5th radio button, then result is displayed as, (I guess, it is returning last three objects) Value: download Selected: False IsDisabled: False Value: regular mail Selected: True IsDisabled: False Value: courier Selected: False IsDisabled: True (**) Regards, Varma On Apr 23, 1:17 pm, Anshoo Arora <[email protected]> wrote: > Note: parentNode does return the parent object (if any) but at the > same time, it can also return an array of childNodes. The reason why > we need to access the childNodes in this case is because, we need to > access each button as accessing the radio group will not give us the > desired result. In other words, without accessing the child nodes, we > will only retrieve the status of the Radio Group. > > Your code (both DOM & QTP) will retrieve all properties of the parent > object, or the selected object, not the child nodes. > > I had tested this code here:http://www.javascripter.net/faq/disablin.htm > with the following exact steps: > > Set oRadioGroup = > Browser("title:=Disabling.*").Page("micclass:=Page").WebRadioGroup("name:=r1","location:=1").Object.parentNode > > For Each oRadio in oRadioGroup > Print "Value: " & oRadio.Value > Print "Selected: " & oRadio.Checked > Print "IsDisabled: " & oRadio.Disabled > Next > > Set oRadioGroup = Nothing > > Guess, it doesn't work in all scenarios and looking at the HTML > structure of other pages, it certainly makes total sense. That means, > more R&D. :) > > Corrected code: > > Set oRadioGroup = > Browser("").Page("").Object.getElementsByName("NamePropertyOfTheRadioGroupObject") > > For Each oRadio in oRadioGroup > MsgBox oRadio.Checked > Next > > -- > You received this message because you are subscribed to the Google > "QTP - HP Quick Test Professional - Automated Software Testing" > group. > To post to this group, send email to [email protected] > To unsubscribe from this group, send email to > [email protected] > For more options, visit this group > athttp://groups.google.com/group/MercuryQTP?hl=en -- You received this message because you are subscribed to the Google "QTP - HP Quick Test Professional - Automated Software Testing" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/MercuryQTP?hl=en
