Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Trying to select a radio button within a webgrid with more than two rows of radio buttons

Status
Not open for further replies.

kdjonesmtb2

Technical User
Nov 19, 2012
93
US
Hello,

I am trying to select a radio button using a htmlid value stored in a datatable as the radio button to select

When there are only two radio buttons the following code works

Browser("ABN-NHP-APP-T15 - QNXT").Page("ABN-NHP-APP-T15 - QNXT_2").Frame("Frame").WebButton("Next Step").Click
Browser("ABN-NHP-APP-T15 - QNXT").Window("Select a Pay-To Affiliation_2").Page("Select a Pay-To Affiliation").Frame("Frame").WbfGrid("dgClmNetwork_DT").WebRadioGroup("htmlid:=rdbSelect").WaitProperty "attrribute/readyState","complete",4000


'
Browser("ABN-NHP-APP-T15 - QNXT").Window("Select a Pay-To Affiliation_2").Page("Select a Pay-To Affiliation").Frame("Frame").WbfGrid("dgClmNetwork_DT").WebRadioGroup("htmlid:=rdbSelect","value:=" & AffiliationID).select "#0"


Browser("ABN-NHP-APP-T15 - QNXT").Window("Select a Pay- To Affiliation_2").Page("Select a Pay- To Affiliation").Frame("Frame").WebButton("htmlid:=btSelect").WaitProperty "enabled","true",4000

Browser("ABN-NHP-APP-T15 - QNXT").Window("Select a Pay-To Affiliation_2").Page("Select a Pay-To Affiliation").Frame("Frame").WebButton("Select").Click

Browser("ABN-NHP-APP-T15 - QNXT").Window("Select a Pay-To Affiliation_2").Page("Select a Pay-To Affiliation").Frame("Frame").WebButton("Select").mictab


When there are more than two radio buttons I attempted to use this code but it is not selecting the radio button


Initialize variables
Dim oDescRadio
Dim oChildren_Tier
Dim RadioToSelect_Value
Dim i

'Create description using Description.Create build-in method
Set oDescRadio = Description.Create
oDescRadio("micclass").value = "WebRadioGroup"
oDescRadio("type").value = "radio"
oDescRadio("htmlid").value="rdbSelect" ' use XML spy to get/confirm name
'oDescRadio("name").value="AF1000046401 " 'use XML spy to get/confirm name


'Pass the description in another variable using ChildObjects method
Set oChildren_Tier = Browser("ABN-NHP-APP-T15 - QNXT").Window("Select a Pay-To Affiliation_2").Page("Select a Pay-To Affiliation").Frame("Frame").WbfGrid("dgClmNetwork_DT").ChildObjects ("oDescRadio")
'Set oChildren_Tier = Browser("ABN-NHP-APP-T15 - QNXT").Page("ABN-NHP-APP-T15 - QNXT").ChildObjects (oDescRadio)
'Loop to select desired value
For i = 0 to oChildren_Tier.Count - 1
RadioToSelect_Value = oChildren_Tier(i).GetROProperty("value")
if RadioToSelect_Value = AffiliationID then
oChildren_Tier(i).Select RadioToSelect_Val
end if

print i
print "RadioToSelect_Value"
print RadioToSelect_Value
'print AffiliationID

Next



The application I am using is HP QTP and it utilizes vbscript
 
I have no clue about HP QTP, but maybe the problem is the missing letters below? just a guess

if RadioToSelect_Value = AffiliationID then
oChildren_Tier(i).Select RadioToSelect_Val[highlight #8AE234]ue[/highlight]
end if
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top