[英]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.