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

what is the silent mode in WR?

1 Answers  


How to extract the data in the below scenario and dump it in the excel? Link1 Link2 Link3 Link4 numberlink1 text text text numberlink2 text text text numberlink3 text text text numberlink4 text text text So, Here is my question? -- It is a matrix but is not a web table(QTP does not recognize it as a web table) -- Link1, link2 and link3 are links under which text is available -- numberlink1 to numberlink4 are again LINKS -- All the others displayed are text only I want to extract the data in the above scenario and dump it into an excel in the same scenario as it is displayed above. Kindly help.. Thank you

0 Answers  


I want some banking domain projects where can i get this projects ( anybody can help me plz)

3 Answers  


what is batch testing?

1 Answers  


I want to open a Notepad window without recording a test and I do not want to use System utility Run command as well. How do I do this?

0 Answers  






How to export data in excelsheet to qtp without using datatable.

4 Answers  


When I used random numbers(1 to 9) with regular expression and run the test, it runs only 5 iterations with passed result instead of running all 1 to 9. Please tell me what can be the reason

0 Answers  


explain structured testing? plz guys with exp. do answer

0 Answers  


what is the difference between development and testing

1 Answers  


anyone can explian about types of "Triggere Events" in QTP

1 Answers  


How to make arguments optional in a function?

2 Answers   Crea,


Can we use index on view?

0 Answers   Wipro,


Categories