How to search for text on a visible page using Puppeteer in a Chromium tab?

I am working on a Puppeteer project and need to locate specific words on an active page displayed in a Chromium tab, rather than targeting a specific URL. If multiple words are searched and none are found as per ‘true.txt’, the output should log a message like ‘none of the words were found’ into ‘false.txt’. This process should repeat for each search. How can I accomplish this?

Yo, you could load the page content into a variable using puppeteer’s page.content() and then use regex or simple string methods to search for those words. If nothing pops up, you can write that message into ‘false.txt’ using Node.js’s fs module. just a thought! :smiley: