Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Using a Radio Button within a WebTable
#1
Solved: 11 Years, 4 Months ago
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 ...
Reply
#2
Solved: 11 Years, 4 Months ago
Hi Michi,

Refer the ChildItemCount,ChildItem methods in QTP help file.

You can do it easily Smile
Reply
#3
Solved: 11 Years, 4 Months ago
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?
Reply
#4
Solved: 11 Years, 4 Months ago
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"
Reply
#5
Solved: 11 Years, 4 Months ago
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.
Basanth
Give a fish to a man and you feed him for a day..Teach a man how to fish and you feed him for life.
Reply
#6
Solved: 11 Years, 4 Months ago
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?
Reply
#7
Solved: 11 Years, 4 Months ago
Since you are working with a webtable you are lucky. Learn about a method called childitemcount for webtable.
Basanth
Give a fish to a man and you feed him for a day..Teach a man how to fish and you feed him for life.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  QTP 11 is unable to recognize prime faces components ,for ex: List and radio butt pradeep singh 8 7,017 02-27-2013, 04:42 PM
Last Post: pradeep singh
  How to click a radio button inside a webtable silpavinod 9 13,691 01-24-2013, 04:09 PM
Last Post: vishalu.vs
  Radio Buttons petes85gt 0 3,360 02-22-2012, 03:41 AM
Last Post: petes85gt
  Click image button in 5th col of a webtable if searchcriteria meets content of 4cols sunshine 2 4,498 08-12-2010, 09:17 AM
Last Post: sunshine
  How to Create Radio Button in QTP edqtp 3 6,829 02-23-2010, 11:10 AM
Last Post: Saket

Forum Jump:


Users browsing this thread: 2 Guest(s)