This is a migrated thread and some comments may be shown as answers.

PDF testing in Browser

3 Answers 75 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
raj palem
Top achievements
Rank 1
raj palem asked on 13 Jul 2010, 07:20 PM

I using developer edition for testing the ASP website. Having problem testing the reporting data opening in PDF format in browser. WebUI test studio could not able to find the controls and data in the browser pdf file. Does the Developer version of WebUI support the PDF file testing?

Appreciate for your time.

3 Answers, 1 is accepted

Sort by
0
Cody
Telerik team
answered on 14 Jul 2010, 01:35 AM
Hi raj palem,

Thank you for evaluating WebUI Test Studio. I hope you are finding it useful. Unfortunately at this time the tool cannot work with PDF files and their internal elements. It only works with HTML web pages and Silverlight applications. The closest we can come to automating PDF's is to blindly simulate mouse clicks on specific points relative to a corner of the PDF outer container.

Regards,
Cody
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Andy
Top achievements
Rank 1
answered on 30 Mar 2017, 07:10 PM
This post is for Boyan.  He found a great solution to this issue, but unfortunately our paths separated before he could post a reply.  So I am here to post what Boyan found.  Thank you Boyan, wherever you are:
Hi guys,

After further researching I have found a very simple solution on how to read a pdf file in code.

1. Download iTextShart from here. It is a free .NET PDF library.
2. Add itextsharp.dll to Test Studio from \itextsharp-all-5.5.8\itextsharp-dll-core folder. Note that before adding you should unblock the dll (right click  -> properties -> unblock).
3. Use that code for reading a pdf file:

Dim fileName As String = "folder\\pdfFileName.pdf"
            Dim text As New StringBuilder()

            If File.Exists(fileName) Then
Dim pdfReader As New PdfReader(fileName)

For page As Integer = 1 To pdfReader.NumberOfPages
Dim strategy As ITextExtractionStrategy = New SimpleTextExtractionStrategy()
Dim currentText As String = PdfTextExtractor.GetTextFromPage(pdfReader, page, strategy)

currentText = Encoding.UTF8.GetString(ASCIIEncoding.Convert(Encoding.[Default], Encoding.UTF8, Encoding.[Default].GetBytes(currentText)))
                        text.Append(currentText)
                         Log.WriteLine(text.ToString())
Next
                        pdfReader.Close()
End If

After executing the coded step the entire text of the pdf file will be stored into “text” string variable and will be logged into the execution log of the test.
0
Andy
Top achievements
Rank 1
answered on 30 Mar 2017, 07:14 PM

sorry the 2 links dropped out: 

Download iTextShart from here: https://sourceforge.net/projects/itextsharp/files/?source=navbar

and

Add itextsharp.dll: http://docs.telerik.com/teststudio/features/coded-steps/add-assembly-reference

 

Andy Wieland

Tags
General Discussions
Asked by
raj palem
Top achievements
Rank 1
Answers by
Cody
Telerik team
Andy
Top achievements
Rank 1
Share this question
or