Micro Focus QTP (UFT) Forums
Identify the Button in a Web table - 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 Interview Questions (https://www.learnqtp.com/forums/Forum-UFT-QTP-Interview-Questions)
+--- Thread: Identify the Button in a Web table (/Thread-Identify-the-Button-in-a-Web-table)



Identify the Button in a Web table - spsraj - 07-29-2010

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


RE: Identify the Button in a Web table - supputuri - 07-29-2010

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.


RE: Identify the Button in a Web table - aravindln - 08-31-2010

Code:
Loc_Index=Browser("title:=XXX").WebTable("html tag:=TABLE","index:=1").GetRowWithCellText(trim(Accountname))
    Browser("title:=xxx").WebRadioGroup("name:=rdLocation").Select "#"&Loc_index



RE: Identify the Button in a Web table - supputuri - 09-01-2010

HI Aravindln,

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


RE: Identify the Button in a Web table - aravindln - 09-29-2010

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)