Micro Focus QTP (UFT) Forums
Using a Radio Button within a WebTable - Printable Version

+- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums)
+-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP)
+--- Forum: UFT / QTP Beginners (https://www.learnqtp.com/forums/Forum-UFT-QTP-Beginners)
+--- Thread: Using a Radio Button within a WebTable (/Thread-Using-a-Radio-Button-within-a-WebTable)



Using a Radio Button within a WebTable - michiusa69 - 04-04-2011

Hello Folks,

I got an Webradio Button within a Webtable. I know the position of the Webradio Button within the Webtable. How do I make QTP to select this Radio Button? I need to mention, that this Radiobutton is part of an WebRadioGroup and is therefore numbered by QTP. The count of the radio buttons within the group can change so. E.g. I can't make sure, that radiobutton #5 will be the same all the time. Who can help? Is there something like -> QTP - please go to row 10 and column 9 and select whatever radiobutton is in there - or at least tell me what button number it is ...


RE: Using a Radio Button within a WebTable - sreekanth chilam - 04-05-2011

Hi Michi,

Refer the ChildItemCount,ChildItem methods in QTP help file.

You can do it easily Smile


RE: Using a Radio Button within a WebTable - michiusa69 - 04-05-2011

Hey Sreekanth,

so as far as I understand, I can use this:

Code:
Set obj = Browser("XXX").Page("ABC").WebTable("DE").ChildItem(row,column,"WebRadioGroup", 2)

obj.Click

I know which Column and which row I want (variables row and column are filled).

Question: Is the index (in this case "2") based on the count of radio buttons within the WebRadioGroup of the specific cell or of the entire WebradioGroup? If so - I still would have the problem to identify the right RadioButton because I dont know, if a readio button realy is within the cell. Am I missing something?


RE: Using a Radio Button within a WebTable - michiusa69 - 04-05-2011

A little bit more explanation ... Wink Here is the Webtable with onw RadioButton Group:

First Run

1,1 -> WebradioButton #0
1,2 -> WebradioButton #1
2,1 -> WebradioButton #2
2,2 -> WebradioButton #3

Secon Run
1,1 -> WebradioButton #0
1,2 -> NO RadioButton
2,1 -> WebradioButton #1
2,2 -> WebradioButton #2
-> see that the index changed? Last button is now #2 and not #3

Third Run
1,1 -> WebradioButton #0
1,2 -> NO RadioButton
2,1 -> WebradioButton #1
2,2 -> WebradioButton #2
3,1 -> WebradioButton #3
3,2 -> NO RadioButton

-> In this example, we got a new colum ...

So what I want to do is this: Dear QTP - please go to column X and row Y and select the correct (!) radiobutton by looking as its index Wink
I also found this code, but again you have to set the <index> which I don't know before running the test ...



Code:
set WebRadioGroupname=Browser("Browsername").Page("Pagename").WebTable("Tablename").ChildItem(<RowCount><Column Count>,"WebRadioGroup",<Index>)
ab= WebRadioGroupname.GetRoProperty("name")
Browser("Browsername").Page("Pagename").WebRadioGroup("RadioGrpLogicalNameFromObjectRepo").SetTOProperty "name",ab
Browser("Browsername").Page("Pagename").WebRadioGroup("RadioGrpLogicalNameFromObjectRepo").Select "#0"



RE: Using a Radio Button within a WebTable - basanth27 - 04-05-2011

Why dont you count the webradiobuttons and then loop through them to find the one you need ?

does it ring the bell Smile I would have posted the code, but since you have been so well in researching and posting it back, i would love to see you take this lead. I am here to help you if you mis-step. But try and let me know what you come up with.


RE: Using a Radio Button within a WebTable - michiusa69 - 04-07-2011

HeHe ... yeah, I will try - I was hoping that there is a Command for doing this: QTP, go to the cell X,Y and then press the Radiobutton within the cell. No chance at all?


RE: Using a Radio Button within a WebTable - basanth27 - 04-07-2011

Since you are working with a webtable you are lucky. Learn about a method called childitemcount for webtable.