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

Sometimes my QTP scripts works fine and sometimes its not though I am using same shared Repository and am not doing any changes in it.Even though for descriptive programming also its works fine and sometimes it does not work.my application is pretty stable.Could anyone please answer why am facing these types of issue??

1 Answers  


What is Cross browser testing? Does UFT support it?

0 Answers  


Whether it is possible to test the adobe's controls like zoom, resize, save etc using QTP...If yes, how u can do the same?

1 Answers  


How to use debug tools?

0 Answers  


1.how can we report the QTP test result in a different excel sheet 2.

3 Answers   Aurigo,


how to write script in qtp(vbscript)..i mean with out application deployed..and how to call script1 into script2?

8 Answers   INCA, Infosys, Logix, SLK Software, Symphony, Wipro,


if mandatory and Assitive propertys are shows same how will u write skript in QTP window

0 Answers   Wipro,


How to capture screenshots of Exceptions/Errors during run- time?

12 Answers   Ordain Solutions,


What is Automation frame work.How we will prepare in real time.

9 Answers   AppLabs,


in QTP,how to write a descriptive program for "yahoo" or "gmail" Login page

1 Answers  


Hi to All, My name is Aditya, i have 4 year exp in software testing (Manual Testing), but i try to shift my career now in automation testing. right now i have no exp or u can say i am not hand exp in live application. So please guide me, what i do ???? Can i join again automation course only practical which is live application. if u know any person who's expert in qtp and he/she ready to take my class i have our own and company laptop. If required i will pay amount please don't mind. Please help me, and i am also planing to join core java from coming 1st Aust (in seed) for only purpose the understanding script of Automation (QTP)... Please help me... I am waitting u r replay... Thank you Thanks again

5 Answers  


I AM NEW IN QTP,PLZ TELL ME ANY BOOKS FOR QTP, MY COMPANY IS QTP,SO I LEARN QTP,PLZ ANYBUDY HELP ME

68 Answers   AZTEC,


Categories