In a Web appl, on a page, there are student names & details
listed.On clicking sort button,details are sorted on
Names.How do u verify htat sorting is done by using QTP?
Answer Posted / ankur_jain
you can use this function for comparing the values and if
your records are shown in webtable then you can use code
like this
in blank spaces between " " you have to pass your own
names
set hp=browser(" ").page(" ")
rc=browser(" ").page(" ").webtable(" ").rowcount
For i=2 to rc step 1
If i=rc Then
sone=hp.webtable(" ").getcelldata(i,1)
stwo=hp.webtable("html id:=dgList").getcelldata(i,1)
end if
sone=hp.webtable(" ").getcelldata(i,1)
stwo=hp.webtable(" ").getcelldata(i+1,1)
ret= CompareValues(sone, stwo)
'then on the basis of ret value you can verify that
list is sorted or not
'Using this function you can compare two values.
'Return values are based on three data types -Date,Numeric
or Text
'Return 1 if value1>value2 OR -1 if value1<value2, 0 if
value1=value2
Function CompareValues(sOne, sTwo) '--- as variant
On Error Resume Next
Dim im1,im2, iRtrn
if (isNumeric(Trim(sOne)) AND isNumeric(Trim(sTwo)))
then
im1 = CDbl(Trim(sOne))
im2 = CDbl(Trim(sTwo))
else
if (isDate(Trim(sOne)) AND isDate(Trim(sTwo))) then
im1 = CDate(Trim(sOne))
im2 = CDate(Trim(sTwo))
else
im1 = Trim(CSTR(sOne))
im2 = Trim(CSTR(sTwo))
end if
end if
iRtrn=0
If im1 < im2 then
iRtrn = -1
else
if im1 > im2 then
iRtrn = 1
end if
end if
CompareValues = iRtrn
If Err.Number > 0 then
strErrorMsg = "Error occured in function
CompareValues "
strErrorMsg = strErrorMsg & "Parameter
values passed to the function are: - ( " & sOne & ", " &
sTwo & ")"
Call ErrorHandler(strErrorMsg)
End If
End Function
| Is This Answer Correct ? | 3 Yes | 0 No |
Post New Answer View All Answers
Explain different recording modes?
By using QTP can we record any log files written by the application which is in execution?
X flies from Hyd to bangalore using different methods of transportation. write the test scenarios and test cases for this?
Give me some real time point of way where exactly we can conduct audits?
terminal services client
How to make qtp understand the difference amongst the same type of objects .suppose there are 5 check boxes in a page and I have to choose the 2nd one, how to do that through script?
what the difference between shared repository and per action repository?
What is recovery scenario manager? When you go for recovery scenario manager?
Explain in brief about the quicktest professional automation object model?
can i change the runtime properties of an object ? How can i check if a parameter exists in database ?
Through array we can execute the testcase how ? give me example
How the exception handling can be done using quicktest professional?
Hi, I'm a beginner in QTP and planning of a certification in QTP, but have no idea about it :P. Could anyone please tell me what certifications that a QTP- beginner can take? What is the fees and the syllabus for the certification? Please reply soon. Thanks Vidhya
How do you handle multiple banners(at the top the page, the banner is scrolling) in a web page(Dont take the name property(regular expression))
What is action split and the purpose of using this in qtp?