'''#################################################################
' Key --> Use <Childitem> method to select required checkbox
' Note --> concentrate on the <index> argument(4th argument of)
Childitem method
''''#################################################################
Dim Arry ' declare array variable
' ----------------- Get the total rows of test data sheet having
runtime mobile names
TestdataRowCount=Datatable.GetRowCount ' Note Here i keept the test
data in QTP Global sheet
For a= 1 to TestdataRowCount
ExpectedMobilename=Trim(Datatable.Value("Mobilename",1))
Arry=split(ExpectedMobilename,";")' ---------- split the
input data based on the ;
If ubound(Arry)=0 Then
ExpectedMobilename=Arry(0)
call createmobile(ExpectedMobilename)
ElseIf ubound(Arry)=1 Then
ExpectedMobilename=Arry(0)
call createmobile
(ExpectedMobilename)
ExpectedMobilename=Arry(1)
call createmobile(ExpectedMobilename)
End If
Next
'%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Function createmobile(ExpectedMobilename)
Browser("Browser").Page("page").Sync
' --------- count the total row in inner most webtable ( table
having the mobile name created during run time )
InnertableRowcount=Browser("Browser").Page("page").WebTable("Transit
Time").RowCount
'''''msgbox InnertableRowcount
For i=1 to InnertableRowcount
' ------- get the mobile name displayed in the application ( say
mobile name is displayed in 2 nd column of inner most table )
ActualMobileName=Trim(Browser("Browser").Page("page").WebTable
("Transit Time").GetCellData(i,2))
''''' msgbox ExpectedMobilename
''''' msgbox ActualMobileName
Res=strcomp(ExpectedMobilename,ActualMobileName,1)
''' msgbox Res
If (Res=0) Then
indexnumber=i-1 ' ------- Get index number
required as argument for -->chilid item method
' ------- create outer most table instances for selecting web check
box by using --> child item method
set Tableobj=Browser("Browser").Page
("page").WebTable("Create Request")
Call TickRequiredCheckBox
(Tableobj,indexnumber)
set Tableobj=nothing
Exit For
End If
Next
End Function
'%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Function TickRequiredCheckBox(Tableobj,indexnumber)
' ------ in outter most table i had only row=1 and column=2
' --------- 1st row 1st column empty
' --------- 1 st row 2nd column has celldata so use 1st row
and 2ndcolumn in child item
set chkboxobj=Tableobj.ChildItem
(1,2,"WebCheckBox",indexnumber)
chkboxobj.set "ON"
set chkboxobj=nothing
End Function
'%%%%%%%%%%%%%%%%%% sample of the object repositary
' Browser ==>Browser
' |
' page ====> page
' |
' Outtermost table ====> Create Request ( put child item for
selecting check box )
' |
' Middle table
' |
' Inner most table ====> Transit Time ( to get mobile name
displayed in application for validation )
'%%%%%%%%%%%%%%%%%% sample of the test data sheet
' Mobilename
' mob_a
' mob_b
' mob_c;mob_d
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
"QTP - HP Quick Test Professional - Automated Software Testing"
group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/MercuryQTP?hl=en
-~----------~----~----~----~------~----~------~--~---