I want to validate the text written in the pdf file for that first i thing i need to read the data from the pdf file is there is any way to do that note: File is available in the mobile device
Asked
Active
Viewed 1,896 times
1 Answers
0
In case you're using Java along with your Appium tests, you may try pdf-util. This library supports comparison of PDF files in both visual and textual modes.
First get your PDF text:
import com.testautomationguru.utility.PDFUtil;
PDFUtil pdfUtil = new PDFUtil();
//returns the pdf content - all pages
String pdfText = pdfUtil.getText("/path/to/file.pdf");
Then in order to compare to expected text:
pdfText.contains(..
or
pdfText.matches(..
In order to access your PDF file on the device, you may try pull-file.
// Java
byte[] pdfFile = driver.pullFile("/internal storage/downloads/filename.pdf");

AutomatedOwl
- 1,039
- 1
- 8
- 14
-
how to find the path of the file available on the mobile device – Love Jun 10 '18 at 10:17
-
my file is in internal storage/downloads/filename.pdf so you mean i need to use like byte[] fileBase64 = driver.pullFile("/internal storage/downloads/filename.pdf"); – Love Jun 10 '18 at 10:21
-
Take a look at the documentation of both pdf-utl and pull-file, then try these libraries in your code and update your question with more practical points. – AutomatedOwl Jun 10 '18 at 10:30