[英]How to fetch the content from the PDF into a string using QTP/VBScript?
我需要使用QTP驗證PDF中的特定內容。 如何使用QTP / VBScript將PDF中的內容獲取到字符串中。 這樣,我就可以驗證PDF中的內容。
請訪問這里 。 您將得到答案,這是在QTP中使用PDF的方法之一。 您還可以通過傳遞鍵(即Ctrl + a然后Ctrl + c)然后從PDF中獲取數據,然后將該數據復制到剪貼板並使用此數據與標准數據進行比較
從PDF獲取數據的示例函數,當在Broweser中打開PDF報告時,其創建時間在datatable中傳遞
Public function CopyPDFData(sDestinationFile)
Dim clip, strText, nCT, fso
nCT = DataTable("bPDFCreationTime", dtLocalSheet)
If nCT ="" Then nCT=1
Browser("CreationTime:=" & nCT).Sync
Browser("CreationTime:=" & nCT).FullScreen
wait(2)
Browser("CreationTime:=" & nCT).WinObject("object class:=AVL_AVView", "text:=AVPageView").Type micCtrlDwn + "a" + micCtrlUp
wait(4)
Browser("CreationTime:=" & nCT).WinObject("object class:=AVL_AVView", "text:=AVPageView").Type micCtrlDwn + "c" + micCtrlUp
wait(4)
Set clip = CreateObject("Mercury.Clipboard" )
strText = clip.GetText
clip.Clear
Set fso = CreateObject("Scripting.FileSystemObject")
Set strfile = fso.CreateTextFile(sDestinationFile, True)
strfile .Write strText
strfile .Close
Browser("CreationTime:=" & nCT).sync
Browser("CreationTime:=" & nCT).close
End Function
讓我知道這是否解決了您的問題,還有其他替代方法可用於使用QTP進行PDF報告測試
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.