Working with Radio buttons

Technology specific object identification, supported applications, web technologies, and 3rd party controls.
SurajJaldu
Posts: 29
Joined: Sat Feb 25, 2012 12:10 am

Working with Radio buttons

Post by SurajJaldu » Fri Jun 01, 2012 10:33 pm

Hi,

Ranorex identifies radio buttons on a webpage individually not as a radio group. If we have a radio group with three options, do we need to add three different objects into OR? I would prefer having one object in OR and selecting the options based on the value provided in the code.

Thanks,
Suraj

User avatar
Support Team
Site Admin
Site Admin
Posts: 12145
Joined: Fri Jul 07, 2006 4:30 pm
Location: Houston, Texas, USA
Contact:

Re: Working with Radio buttons

Post by Support Team » Mon Jun 04, 2012 5:25 pm

Hi,

You can of course just add one of the radio buttons to the repository, but then you have to use a repository variable otherwise Ranorex will not be able to identify the other ones during runtime, I would suggest taking a look at the following link: Using Variables within the Repository.

Regards,
Markus
Ranorex Support Team

SurajJaldu
Posts: 29
Joined: Sat Feb 25, 2012 12:10 am

Re: Working with Radio buttons

Post by SurajJaldu » Mon Jun 11, 2012 11:36 pm

Thanks Markus for the reply. I could select the radio buttons by parametrizing the properties. But, I am still uncomfortable with verification because you can't directly get Value of selected radio button. Rather I need to check if each radio button in the group is selected or not to find the selected one.

Any thoughts?

User avatar
Support Team
Site Admin
Site Admin
Posts: 12145
Joined: Fri Jul 07, 2006 4:30 pm
Location: Houston, Texas, USA
Contact:

Re: Working with Radio buttons

Post by Support Team » Tue Jun 12, 2012 3:51 pm

Hi,

You're welcome!
Can you send/post us a Ranorex Snapshot file of the radio buttons? This will help us analyzing the issue.
Following link will show you how to generate a snapshot file:
Creating Ranorex Snapshot Files

Regards,
Markus
Ranorex Support Team

SurajJaldu
Posts: 29
Joined: Sat Feb 25, 2012 12:10 am

Re: Working with Radio buttons

Post by SurajJaldu » Tue Jun 12, 2012 8:18 pm

Hi Markus,

I've attached the snapshot file for radio button's parent so that you can see information of both the radio buttons (in this case Name & Account) in the group.

I've observed that this is the general behaviour of Ranorex with web radio buttons and it is not specific to just this application/web page.

Please let me know in case I need to provide more information.

Thanks,
Suraj
You do not have the required permissions to view the files attached to this post.

User avatar
Support Team
Site Admin
Site Admin
Posts: 12145
Joined: Fri Jul 07, 2006 4:30 pm
Location: Houston, Texas, USA
Contact:

Re: Working with Radio buttons

Post by Support Team » Wed Jun 13, 2012 10:47 am

Hi,
SurajJaldu wrote:Please let me know in case I need to provide more information.
What exactly do you want to perform/which scenario do need help with?
Please provide us the scenario you want to perform to help us providing a fitting solution.

Regards,
Tobias
Ranorex Team

SurajJaldu
Posts: 29
Joined: Sat Feb 25, 2012 12:10 am

Re: Working with Radio buttons

Post by SurajJaldu » Wed Jun 13, 2012 6:26 pm

I would like to know which radio button is selected in the radio group.

Thanks,
Suraj

sham526
Posts: 34
Joined: Wed Jul 07, 2010 7:12 am
Location: Hyderabad(INDIA)

Re: Working with Radio buttons

Post by sham526 » Thu Jun 14, 2012 6:15 am

one way is to
1) Store the parent object(like table/container) in the repository.
2) Take the count of radio buttons present.
3) Go to each radio button using FOR.
4) Check for the property "CHECKED".

For i as integer = 1 to count-1
If object.checked then
'Radio button was selected.
Exit For
else
'Radio button was NOT selected.
end if
Next

SurajJaldu
Posts: 29
Joined: Sat Feb 25, 2012 12:10 am

Re: Working with Radio buttons

Post by SurajJaldu » Thu Jun 14, 2012 7:07 pm

Hi Sham,

That's how I am doing it now. But, I don't like that approach and checking if there is a better solution. Thanks for your help.

Thanks,
Suraj

User avatar
artur_gadomski
Posts: 207
Joined: Mon Jul 19, 2010 6:55 am
Location: Copenhagen, Denmark
Contact:

Re: Working with Radio buttons

Post by artur_gadomski » Fri Jun 15, 2012 7:11 am

You can form a RxPath to find the checked radio button. Instead of name or text as attribute just use checked = true (or whatever it is for radio buttons). This way no matter which radio button is checked you will get it.

sham526
Posts: 34
Joined: Wed Jul 07, 2010 7:12 am
Location: Hyderabad(INDIA)

Re: Working with Radio buttons

Post by sham526 » Fri Jun 15, 2012 10:30 am

can try below as artur_gadomski said,

Dim bool as boolean=host.local.tryfindsingle("./form/....../table[@id='ctl......']/tbody/tr/td/input[@checked='True']")
If bool then
'Found the selected Radio button.
else
'Not Found.
end if