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

Answers were Sorted based on User's Feedback



I have multiple radio buttons i need to select a radio buton and i dont want to hard code i have a..

Answer / 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

I have multiple radio buttons i need to select a radio buton and i dont want to hard code i have a..

Answer / ashish

hi, What you can do is
Create a function which accepts a parameter (Index #).
Pass the index number to the radio button u need to click.

Is This Answer Correct ?    35 Yes 14 No

I have multiple radio buttons i need to select a radio buton and i dont want to hard code i have a..

Answer / rahul

use select #x

pass the x as a variable

Is This Answer Correct ?    23 Yes 5 No

I have multiple radio buttons i need to select a radio buton and i dont want to hard code i have a..

Answer / saisree

Hi

i tried to solve my problem but i didn't get how to do. can you please help me.

I have one web application in that when you are going to click webedit that will generate one window in that so many radio buttons are there i have click one radio button but all the properties are same for all radio buttons and index is not there and i have to select randomly i tried above code also its not working. please help me

My code:
With browser("title:=Hospital Management System")
With .page("title:=Hospital Management System")

.link("name:=Transactions","x:=-11215").Click
.link("name:=Purchase Invoice","x:=-23040").Click
.webedit("name:=supcode").Click
Dim variable2
Set desc=description.Create()
desc("micclass").value="WebRadioGroup"
Set radio=.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
variable2=RandomNumber(0,(itemcount-1))
randselection="#" & variable2

Mesgbox showing "0" radio buttons in page

End with
End with

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More QTP Interview Questions

How many types of Check Point in QTP

2 Answers   R Systems,


What is the limitations of BVA?

1 Answers   IBM,


An action has both shared and local OR associated with it and both have the same object in them. In the test which one will be considered?

0 Answers  


how can I read text in browser and export the same into text file?

5 Answers   HP,


Take a situation when you are working with QTP, suddenly system has crashed.so you again start the system. My questyion is how can QTP directly opened when the system desktop appears.

2 Answers  






What is the differences between image check point and bit map check point?

0 Answers  


Whether qtp 9.0 supports Test director8.0

0 Answers   TCS,


What's QuickTest Window?

1 Answers  


Hello Everyone, In QTP we have one option Data Driver wizard that comes in Tools -> Data Driver. so, please tell me abtout the use of Add Value and Parameterize options available in Data Driver wizard. And also the concept of value, constants, Parameterized displayed in the wizard. Please explain by giving the example. Thanks in advance, Gaytri

2 Answers  


How to make arguments optional in a function?

0 Answers   Crea,


Shall we add Local Repository to shared object repository,if yes,how we add

4 Answers  


Explain quicktest professional testing process?

0 Answers  


Categories