This thread is trying to answer question "How can I validate PDF and Word documents in an automation process using the Playwright TypeScript framework?"
Downloading the Files: You can use Playwright to download the PDF or Word files by navigating to the URL and triggering the download. Reading PDF Files: You can use a library like pdf-parse to read the content of the PDF Reading Word Files: For Word files, you can use a library like mammoth.js to extract the text. Comparing the Files: Once you have the content of the files, you can use simple string comparison to compare the baseline documents with the new ones.
I’m also seeing this within the docs but personally never used it - https://playwright.dev/docs/api/class-download#download-create-read-stream
Rayrun is a community for QA engineers. I am constantly looking for new ways to add value to people learning Playwright and other browser automation frameworks. If you have feedback, email [email protected].