I have multiple radio buttons i need to select a radio
buton and i dont want to hard code i have a generic
function for it there i have used select#0 so it selects
first radio button but for other script i want to select
the 4th radio button how i can make it still more generic

Answer Posted / menaka

count the radiobutton in the appliation and u can select
the last radio button or the u can select radiobutton
randomly.

here is the code..

Set desc=description.Create()
desc("micclass").value="WebRadioGroup"
Set radio=Browser("...").Page("..").ChildObjects(desc)
radiocount=radio.count
msgbox radiocount

For i=o to radiocount-1
itemcount=radio.item(i).GetRoProperty("items count")
msgbox "item count:" & itemcount

Next

'FOR SELECTING THE LAST RADIO BUTTON
variable1="#" & itemcount-1

'so use the variable1 wherever u want to select the item.

'RADOM SELECTION OF RADIO BUTTON

variable2=RandomNumber(0,(itemcount-1))
randselection="#" & variable2

'use variable2 where ever u want to select the radiobutton
randomly.

Is This Answer Correct ?    26 Yes 4 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is test object model in quicktest professional (qtp)?

534


hi all here i have tab named "Workbench" By clicking on "workbench" tab.it displays 4 tabs like below workbench common cargo commercial charter "common" tab have 10tabs inside,"cargo" tab also haveing 15 tabs inside and remaining two tabs also having few tabs inside. when clicked on "common" tab.it displaying the script like tab("workbench").select"common" if i clicked on "cargo".it displaying the script like tab"workbench_2").select"cargo" if i clicked on "commercial".it displaying the script like tab"workbench_3").select"commercial" if i clicked on "charter".it displaying the script like tab"workbench_4").select"charter" I have used a "FOR LOOP" for common,commercial,cargo,charter tabs.it was stopped at second tab SO, CAN I RECOGNIZE "WORKBENCH_2,_3,_4" AS A SINGLE VARIABLE if not, can anyone plese help me to solve this

1504


What are the features supported by UFT?

657


what is the difference between IE & Netscape in web testing on a log in page

1779


How can you exit from an action?

605






Hi All, How to get repeated word in string . Thanks Balaji

924


What are the key points to create a framework in QTP for oracle forms?

1795


What is the use of running the scripts in Hidden-mode in UFT?

676


How to save your test using quicktest professional?

520


what is the difference between the modular framework and datadriven frame work

1900


how to acess a test in RSA?

1657


How to use the object spy in quicktest professional 8.0 version?

534


What if recovery scenarios is also failed for identify the alert ? (We are handling unexpected popup through recovery scenarios but if still recovery scenarios also failed than what should be the approach)

1003


i have two questions for regular expression :- Q1. I have date pattern eg-29/11/2011 29-11-2011 29.11.2011 Que- if any separator is there between date,month and year pattern should match else it should not match eg- pattern should not match in case of 2911-2011 Q2. let say i have a string and there is a number in between of that string eg.-Amount 30002.234 successfully credited to your account . now i have to match this pattern in such a way that even if decimal is not there pattern should match ,how i will do this using regular expression

1016


What is the syntax to call one script from another?

526