QTP Forums

Full Version: Identify the Button in a Web table
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi all,

Here is one question that keep on making my face like this - Sad

There is one web table with n' no of rows and columns. Its first column is with Radio button or check boxes and its last(it can be any) column is with a button or link. As an input we are passing one value in first column. We need to select one check box and click on the button of that row in the last column.

Eg.

WebTable - Donations
First column - Account Names
Last Column - Donate. (Buttons)

Here We are passing the Account Name. Check boxes are displayed with account names. So select the particular check box and click on Donate button from the last column of the selected account.

I hope the question is clear..

Please help..
Thanx
HI spsraj,

You can use the GetRowWithCellText method to work with these scenarios.

Code:
ClickWebButtonInWT "12345"
Public Function ClickWebButtonInWT(strAccNumber)
blnAccountNames = False
blnDonate = False
For ColCount = 1 to object.ColumnCount(1) ' To get the number of columns.
  If trim(object.GetCellData(1,ColCount)) = "Account Names" Then
    ColAccountNames = ColCount
    blnAccountNames = True
  ElseIf trim(object.GetCellData(1,ColCount)) = "Donate" Then
    ColDonate = ColCount
    blnDonate = True
  End If
If blnAccountNames = True and blnDonate = True Then
  Exit For
End If
Next

IntRowNum = object.GetRowWithCellText (strAccNumber,ColAccountNames)
Set objWB =  object.ChildItem(IntRowNum ,ColAccountNames,"WebButton",0)
objWB.Highlight
objWB.Click
Set objWB = Nothing
End Function

Please let me know if you need any more info.
Loc_Index=Browser("title:=XXX").WebTable("html tag:=TABLE","index:=1").GetRowWithCellText(trim(Accountname))
Browser("title:=xxx").WebRadioGroup("name:=rdLocation").Select "#"&Loc_index
HI Aravindln,

Do you think the sol'n provided by you will solve the isse.....????
(09-01-2010 12:48 AM)supputuri Wrote: [ -> ]HI Aravindln,

Do you think the sol'n provided by you will solve the isse.....????

Hi,
Yes here I am getting the index value of that checkbox and clicking on the concerned check box...In my project I am using the same for radio button, Note: It gives count value as little bit extra. bcoz it counts the column headers also in web table .so use (index - headers count in web table)
i identified the button earlier but now i forgot.
Reference URL's