← Back to Discord Forum

validate pdf and word dock

In my automation I have to deal with validation of pdf and word , I mean we can make baseline docks and validate the same again the new one , how to achieve that in playwright typescript framework, can someone please help , thanks

This thread is trying to answer question "How can I validate PDF and Word documents in an automation process using the Playwright TypeScript framework?"

1 reply

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

Related Discord Threads

AboutQuestionsDiscord ForumBrowser ExtensionTagsQA Jobs

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 luc@ray.run.