Is it possible to run Puppeteer inside another web page?

45 Views Asked by At

I am looking to create a web app which will launch a web page via puppeteer in an iframe and allow me to interact with it directly through buttons in the main page UI (not the iframe page).

Let me try to explain a little more clearly.

I audit web sites a lot for my job (I work in compliance) and currently use the EDPS's tool called Website Evidence Collector. I recently started to look at the EDPB's Website Audit Tool which is based on WEC but is contained in an electron app.

This allows me to interact with the page directly within the Electron app for doing things like taking screenshots, click on buttons, enter user credentials etc. but the downside is that it is a desktop app so it is not particularly scaleable.

I want to reproduce the same abilities in the browser via a web app so that my team can use the same tool with all the audit data being saved to a central database instead of local JSON files but I cannot find any information on controlling Puppeteer via a web based GUI (other than running it in non-headless mode which would simply run the puppeteer processes in a new chrome instance rather than embedding it into a web app and being able to pipe processes/commands directly into puppeteer).

So I am just curious if anyone has tried this and what level of success they might have had? My plan is to create such a tool for my work but then also to release it publicly so others can do their own audits and file legal complaints when a web site is in breach of privacy laws. But I need to be able to GUIfy it otherwise this won't be possible.

See https://code.europa.eu/edpb/website-auditing-tool

1

There are 1 best solutions below

0
user1955078 On

Puppeteer is a node.js api, as such, from a usual browser, you will have to create a ad-hoc webservice with which your iframe will interact. You can find tutorials on github that use Puppeteer with backend web application frameworks such as express.js.

Alternatively, it's outside the scope of your requirements though, you can launch puppeteer from main process of the website auditing tool through the GUI of the tool using IPC calls. But it implies users to download your tool.