Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Need help - working with Web Radio Buttons
#1
Solved: 10 Years, 9 Months, 2 Weeks ago
Hi,

I am using Version 9.1 of QTP and working on Web Applications using IE as the browser. I have the following 1 questions..
1) When I log into an application, a page is displayed having WebradioButton Group (there are 2 radio buttons on the page with the same "name") and one of the buttons is selected by default (the first of the two) . I want to verify that the first radio button IS indeed selected. How can I do this? Is there any function/method to check this?

2) I have a WebTable (say 'x') in my application .. (The application actually contains many nested tables ). I have not added the 'x' object to my object repository. I have the following function in my code.. I am not able to retrieve the rowcount and columncount for the table.

Code:
'Function ValidateFields(oPage)
   On Error Resume Next
   Dim intIndex , intRowCt,  intColCt, oTableObj
    intIndex = GetIndex("WebTable", oPage) 'Returns the index of the table 'x'
    Set oTableObj = oPage.WebTable("index :="&intIndex , "html tag:=TABLE ")
    intRowCt  = oTableObj.RowCount  'does not return row count of table 'x'
    intColCt = oTableObj.ColumnCount(1) 'does not return column count of table 'x'
    ..

'End Function

Please advise
Thanks.


Question 2 cont..
I tried adding the Web Table to the object repository too, Since Rowcount , and ColumnCount are test object properties. Still I cannot retrieve the valuesfor rowcount and columncount. Please advise!
Reply
#2
Solved: 10 Years, 9 Months, 2 Weeks ago
1) Use GetRoProperty
2) I can see that you are trying to use COM, it will not return expected value until your object supports the said method.

I would suggest check with Spy which property returns rowcount and column count.
Once you have the property use the same with DP in your function above.

no need to add the web table to object repository since you are working with DP.
Want to fast track your QTP/UFT Learning? Join our UFT Training Course
Reply
#3
Solved: 10 Years, 9 Months, 2 Weeks ago
Thanks for the quick response Ankur.
I updated my code based on ur suggestions.. as follows.

Code:
Function ValidateFields()
   On Error Resume Next
   Dim intIndex , intRowCt,  intColCt, oTableObj,var_index, var_cols , intcount
   Set oPage = Browser("xyz").Page("xyz")
    intIndex = GetIndex("WebTable", oUSTPage)
   Set oTableObj = oPage.WebTable("Index :="&intIndex , "html tag:=TABLE ", "name:=WebTable") //Statement 1
var_col1 = oTableObj.CokumnCount(1)
var_col2 = Browser("xyz").Page("xyz").WebTable("x").ColumnCount(1) //Statement 2
End Function

Here , var_col2 is returning correst response and var_col1 is returning 'empty'
In statement 2 above, the webTable -x has been added to Object repository and has the properties -html tag and index .And Smart Identification has been enabled (but not used )

In Statement 1 , I am using the exactly same properties to describe the object, but QTP returns - too many objects found with the same properties. I then added another property -"name" and I am still getting the same error. My GetIndex function is returning the correct value of index.

Could you please advise why the object is not identified in Statement 1 here?

Thanks much!
Reply
#4
Solved: 10 Years, 9 Months, 2 Weeks ago
Everything seems to be perfect, check once again that you are including all the properties for statement 1

If problem persists please attach the screenshot(s) of object repository and corresponding result(s) for both the cases.
Want to fast track your QTP/UFT Learning? Join our UFT Training Course
Reply
#5
Solved: 10 Years, 9 Months, 2 Weeks ago
Hey Ankur,

The code suddenly started working today!! just out of the blue. I did not make any changes. Smile Thanks for your time and help.

Regarding the radio group button selection , you said I need to use GetROProperty. But what is the exact property I should be looking for? I have tried spying the object , but cant make out what propery i shiuld be using to validate that one of the 2 radio buttons (like the first radio button) is selected.

Thanks again!
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 6,682 02-27-2013, 04:42 PM
Last Post: pradeep singh
  How to click a radio button inside a webtable silpavinod 9 13,258 01-24-2013, 04:09 PM
Last Post: vishalu.vs
  Capturing lines between java buttons cowboy49 0 1,688 08-19-2012, 04:52 AM
Last Post: cowboy49
  QTP Opens a popup window but won't recognize the buttons in the window Blaster0007 4 7,661 07-20-2012, 12:03 AM
Last Post: sree.85
  Radio Buttons petes85gt 0 3,124 02-22-2012, 03:41 AM
Last Post: petes85gt

Forum Jump:


Users browsing this thread: 1 Guest(s)