top of page

Validate pdf data using Selenium Webdriver

Read PDF content to validate its content using PDFbox libraries in Selenium Webdriver. PreReq: Add dependency of PDFbox : PDDocument document = PDDocument.load(pdf_file_path);
PDFTextStripper PDFstripper = new PDFTextStripper();
String content = PDFstripper.getText(document);

System.out.println(content);

If("your_content").contains(content)
{
System.out.println("Pass");
}else{
System.out.println("Content not found");
}

Validate pdf data using Selenium Webdriver
bottom of page