PDF Comparison Using Selenium in Python | QA Automation | PDF Texts Extraction

Опубликовано: 03 Ноябрь 2024
на канале: Shine Vision
4,356
42

In this tutorial, we will be downloading PDF file from any webpage and compare that PDF with the predefined or existing PDF. We will be using selenium library to download PDF file and will use PyPDF2 python library to extract the text from PDF.

To resolve deprecated library error in PyPDF2 3.0.0
Replace following code of Line number 53, 54 and 55

read_pdf = PyPDF2.PdfFileReader(pdf_file)
page = read_pdf.getPage(1)
page_content = page.extractText()

with

read_pdf = PyPDF2.PdfReader(pdf_file)
page = read_pdf.pages[1]
page_content = page.extract_text()