How to compare 2 excel files using QTP?
How to compare 2 PDF files using QTP?



How to compare 2 excel files using QTP? How to compare 2 PDF files using QTP?..

Answer / 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

More QTP Interview Questions

How to make arguments optional in a function?

2 Answers   Crea,


the presentation layer of my application is built using VB 6.0 and a series of C++ dlls and components. We do not use Java, VB.Net, C## or any other component that can be decompiled. We are automating the application using HP Quick Test Professional. It is not reconginizing the combo boxes, tabs etc.... Could you please suggest, whether QTP supports C++ dlls and components or not...if yes, could you please guide me, how to overcome this situation. Can we install any special add-ins for this C++? .When we are performing the recording/execution, the application becomes very slow. Your quick response will be highly solicited in this regard.

1 Answers   Wipro,


I need diffrences between Object Identification, Smart Identification, Regular expresion,Low-Level Recording (enables you to record on any object in your application, whether or not QuickTest recognizes the specific object or the specific operation.) I am working on Web Application. In that object caption will change dynamically. For example, consider “Save” button. On clicking save button the caption changing as “ EDIT ”. From above concept which concept I have to use here?

2 Answers   Ordain Solutions,


what is the difference between rational rose and QTP? WHICH TOOL IS BETTER TO LEARN? PLEASE SEND ME AT sana_50218@yahoo.com sandeep@epuratech.com

0 Answers   EpuraTech,


On the website, the protocol has been changed https: to https what you will do? Tell me your approach?

0 Answers  






I have action1, action2, action3 r there.my query is while executing if i get any error in action1 i want exit from here itself, otherwise execute action2, if i get any error in action2 i want exit from hereitself, like this,what is the method for this?

5 Answers   AZTEC,


Diff b/w Test Design and Test case design? What is the Design Review's and Code Review's. When will you conduct tese reviews?

1 Answers  


How to Close all browsers in reverse order.

3 Answers   Marlabs,


What are the types of Object Repositories in QTP?

9 Answers  


Is there anyway to have QTP go into a website and map out every object before I actually record any tests? I basically want to map out a website with all the objects and build a complete repository. The reason is because I'm running into issues with hierarcical objects. for example: Browser("ABC company- Home").Page("ABC company - Home").Link ("About Us").Click Browser("ABC company - Page 2").Page("ABC company - Page 2").Link("About Us").Click Both these links ("objects" and I use that term loosely as I'm trained mostly in OO programming) go to the same place but but the object heirarchies (pages) are different. I want a repository that will find any possible link on any possible page without having to manually record it. Is there a way to do this?

1 Answers  


How will you handle application crash using recovery scenario manager(step by step process)?

1 Answers  


What is the extension of script and object repository files?

4 Answers   Crea,


Categories