How to compare 2 excel files using QTP?
How to compare 2 PDF files using QTP?
Answer Posted / srihari j
How to compare 2 PDF files using QTP?
Dim varPath1, varPath2, str1, str2
varPath1 = "C:first.pdf"
varPath2 = "C:second.pdf"
str1= getPDFText (varPath1)
str2= getPDFText (varPath2)
if StrComp(str1,str2,0) <> 0 Then
msgbox "PDF files do not have same text content"
else
msgbox "PDF files have same text content"
end If
Public Function getPDFText (varPath)
Dim MyClipboard
SystemUtil.Run varPath
Window("regexpwndtitle:=Adobe Reader","regexpwndclass:=AdobeAcrobat").Type micAltDwn + "t" + micAltUp
Window("regexpwndtitle:=Adobe Reader","regexpwndclass:=AdobeAcrobat").Type "s"
Window("regexpwndtitle:=Adobe Reader","regexpwndclass:=AdobeAcrobat").Type micDwn
Window("regexpwndtitle:=Adobe Reader","regexpwndclass:=AdobeAcrobat").Type "Enter"
Window("regexpwndtitle:=Adobe Reader","regexpwndclass:=AdobeAcrobat").Type micCtrlDwn + "a" + micCtrlUp
Window("regexpwndtitle:=Adobe Reader","regexpwndclass:=AdobeAcrobat").Type micCtrlDwn + "c" + micCtrlUp
Set MyClipboard = CreateObject("Mercury.Clipboard")
getPDFText = MyClipboard.GetText
MyClipboard.Clear
Set MyClipboard=Nothing
Window("regexpwndtitle:=Adobe Reader","regexpwndclass:=AdobeAcrobat").Activate
Window("regexpwndtitle:=Adobe Reader","regexpwndclass:=AdobeAcrobat").Close
End Function
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
What are the properties you would use for identifying a browser and page when using descriptive programming?
Why script error occur in between recording in qtp?
How to import a test case present in ".xls" file to TD under a Test set?
When I click on a link in web page.Link should open in new window.can anyone please let me know the script for this ---Koti
Can any one tell me.......How the test engg's start testing in the compy environment.....real time tester PLSSSS help me i need in depth information regarding this...
There is an built in window application in qtp9.1,i.e.Flight4.0.i want to implement the recovery maneger on it.How can i do this?
how to acess a test in RSA?
what is object and child object.. explain ..if possible give some example for better understanding ..
Suppose I have three hyperlinks with same properties. How to solve this and what are the ways to solve this. we can solve this by using index property but what are the other ways we have have to solve this problem. Login (href: btnlogin.aspx) Login (href: Sourcelogin.aspx) Login (href: homelogin.aspx)
what is keyword driven testing in qtp?n how is it useful?
How can I change object description or check point values in qtp?
Describe synchronization point.
Why is action split used by qtp?
What is synchronization point in QTP?
How do you do batch testing in wr and is it possible to do in qtp, if so explain?