Today i thought of sharing the common practical scenario to excel in Interview of UFT/QTP
Scenario:-
We want UFT to select checkbox in the table corrensponding to company name of “Oracle“.
Scenario:-
We want UFT to select checkbox in the table corrensponding to company name of “Oracle“.
Dear readers please share your solutions, it will be of great help for buddy job seekers
More Questions?
5 replies on “Practical UFT Interview questions-Part-2”
First apply table checkpoint on specified table and edit that checkpoint as below
nIndex=Browser("").Page("").Frame("MainFrame").WebTable("").GetRowWithCellText("Oracle")
Now Use DP
Set oChekBox = Description.Create
oChekBox ("micClass").Value = "WebCheckBox"
oChekBox ("Index").Value = nIndex
Browser("").Page("").Frame("").WebCheckBox(oChekBox).Set "ON"
Hope it will work for this scenario…
nIndex=Browser("").Page("").Frame("MainFrame").WebTable("").GetRowWithCellText("Oracle")
Now Use DP
Set chkobj =
Browser("").Page("").Frame("").WebTable("").ChildItem(3,2,"WebCheckbox",0)
chkobj .Set "ON"
row_no=browser().page().webtable().getrowwithcelltext("Oracle")
set ob=browser().page().webtable().childitem(row_no,2,"webcheckbox",0)
ob.set "on"
row = Browser.Page.WebTable.RowCount
For i = 1 To row
Company = Browser.Page.WebTable(i,"Company")
If Company = "Oracle" Then
Set obj = Browser.Page.WebTable.ChildItem(1, "Check", "WebCheckbox",0)
obj.Set "ON"
Exit For
End If
Next
Set owt=Browser().Page().WebTable()
introwcount=owt.RowCount
intcolcount=owt.ColumnCount(1)
'GetHeader position for "Compnay" and "Check" text
For column = 1 to intcolcount Step 1
If owt.GetCellData(1,column)="Company" then
CompanyColPos=column
ElseIf owt.GetCellData(1,column)="Check" Then
Checkcolpos=column
End If
Next
'Loop from 2nd row to last row of the webtable
For r=2 to introwcount Step 1
rowfound=owt.GetRowWithCellText("Oracle")
If Rowfound<>-1 Then
Set checkboxobj=owt.ChildItem(rowfound,Checkcolpos,"WebCheckBox",0)
checkboxobj.Set "ON"
Exit For
Else
"Msgbox "Oracle" does not appear in company list
End If
Next