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
In QA Testing when do you use Loadrunner vs QTP? What are the main differences between those two tools? Explain the purpose with real world scenario examples...In advance thank you!!!
Shall we add Local Repository to shared object repository,if yes,how we add
Can anyone pls tell me how to do action parameterization (input and output parameters) with respect to login window and insert order of flight reservation window in detail( pls give a clear step by step explanation with example) anyone please. Will be very thankful to u
How do Parameterization and Data-Driving relate to each other in QTP?
Why we use QTP ,We can use other tools like WR OrSilktest What r the options in Qtp that WR and Swilktest Does not have.
QTP script is not working on other's machine..
What is the file extension of the code file in qtp?
what is the difference between data driver & data driven and driver script?
In an interview, what r the general questions asked in SQL which is realted to testing ?pls give me anwser to this question?
Can anyone help.i need total excelsheet operations,shortcuts in testing environment from starting onwards....
what r the main attributes of test automation?
how to evalute defects in QTP script?
What are metrics and matrix?
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
Explain the concept of object repository & how qtp recognizes objects?