Results 1 to 9 of 9

Thread: I want to check selected and not selected radio button

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Geek_Guest
    Guest

    I want to check selected and not selected radio button

    I am new to QTP and using QTP 8.2. There are two radio buttons in a web page and by default first one is selected. User can select any one of them. Now when user comes to this page first time, I want to check that first radio button is selected and second one is not selected. How can I do that? Thanks.

    Question asked by visitor Aakash


  2. #2
    Junior Member
    Join Date
    May 2009
    Answers
    2

    Re: I want to check selected and not selected radio button

    i m alos facing same problem


  3. #3
    Expert Member
    Join Date
    Jun 2008
    Answers
    204

    Re: I want to check selected and not selected radio button

    Hi there,

    You have manipulate your test logic. below is example of how to select radio button - there are two radbut (1) Checking and (2) Saving

    for i = 1 to 2
    if i = 1 then
    browser("b").Page("p").WebRadioGroup("rb").Select "check"
    else
    browser("b").Page("p").WebRadioGroup("rb").Select "saving"
    End If

    Next


  4. #4
    Junior Member
    Join Date
    Dec 2009
    Answers
    27

    Re: I want to check selected and not selected radio button

    Quote Originally Posted by learqtptesting View Post
    Hi there,

    You have manipulate your test logic. below is example of how to select radio button - there are two radbut (1) Checking and (2) Saving

    for i = 1 to 2
    if i = 1 then
    browser("b").Page("p").WebRadioGroup("rb").Select "check"
    else
    browser("b").Page("p").WebRadioGroup("rb").Select "saving"
    End If

    Next
    in case of webradiogroup ?


  5. #5
    Junior Member
    Join Date
    Nov 2009
    Answers
    1

    Re: I want to check selected and not selected radio button

    When I'm using Radio Button, It is not working plz help me how to use it?


  6. #6
    Junior Member
    Join Date
    Oct 2009
    Answers
    12

    Re: I want to check selected and not selected radio button

    you can use GetROProperty
    intIndex = browser("b").Page("p").WebRadioGroup("rb").GetROProperty("selected item index"). This will return 1 or 2, in your case.
    But if both the radio buttons are not checked it may return the default values index. So validate one more property "checked". If this property returns one then it means that one of the radio button is selected.
    intChecked = browser("b").Page("p").WebRadioGroup("rb").GetROProperty("checked")
    If intChecked is equal to 1 then proceed with your validation.


  7. #7
    Expert Member
    Join Date
    Apr 2008
    Answers
    1,859

    Re: I want to check selected and not selected radio button

    Hi friend,

    If this is web radio group then use status ON and OFF.

    Thanks,
    Deepa

    Arise Awake And Stop Not Till The Goal Is Reached

  8. #8
    Junior Member
    Join Date
    May 2010
    Answers
    1

    Re: I want to check selected and not selected radio button

    This is for QTP10:
    ' Loops through swfRadioButton in a frame, gives name & if it is selected

    ' Windowname is the name of your window
    ' framename is the container in which the radio buttons are located
    set container = SwfWindow("Windowname").SwfObject("framename")
    Set Desc = Description.Create()
    Set ChildObjects = container.ChildObjects(Desc)
    cnt = ChildObjects.Count

    If cnt > 0 Then

    For i = 0 To cnt - 1
    mybuttons = mybuttons &ChildObjects.Item(i).GetROProperty("name") & ": checked="& ChildObjects.Item(i).GetROProperty("checked") &VbCrLf

    Next
    Else
    msgbox container.ToString() & " does not have any child objects."
    End If

    msgbox mybuttons

    Set container = nothing
    Set desc = nothing
    Set chilobjects = nothing
    cnt=""
    mybuttons = ""


  9. #9
    Junior Member
    Join Date
    Jan 2009
    Answers
    1

    Re: I want to check selected and not selected radio button

    Hi Akash...
    Hope your problem is solved.
    Else

    1) You can use GetRoProperty and get the value of property "Value" form the webRadioGroup which you are referrring, the retrun value will contain the radio button which was selected. (If the webRadiogroup has a value for each radio button option)

    2) You can use GetRoProperty and get the value of property "selected item index" form the webRadioGroup, the retrun value will contain index (Index starts from 1) of the selected radio buttion which was selected. (If the webRadiogroup doesn't have value for each radio button option)

    hope this will help you.

    Regards,
    kumar


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
About us
Applying for a job can be a stressful and frustrating experience, especially for someone who has never done it before. Considering that you are competing for the position with a at least a dozen other applicants, it is imperative that you thoroughly prepare for the job interview, in order to stand a good chance of getting hired. That's where GeekInterview can help.
Interact