Manipulate embedded / recreated web page

I want to be able to “embed” a web page, and be able to manipulate the resulting page (click(), textContent etc).

I now understand that’s not possible for security reasons. I tried iframe, embed, objects.

Is it possible to fetch the HTML of the page, insert that into a frame / div, and then manipulate that ‘recreated’ page? I guess I’d need to write a function to add parts to the code so it all looks like a faithful recreation (I don’t think I need help with this part).