evaluateOnNewDocument on all new pages
See original GitHub issueHello I am using the following piece of code to prevent websites from detecting puppeteer.
const page = await browser.newPage();
page.evaluateOnNewDocument(readFileSync("puppeteer-detection-bypass.js"));
The problem is that when I click on a link with the “target” attribute set to “_blank”. The browser opens a new tab and puppeteer is detected because the evaluateOnNewDocument is not set for this new page.
How can I handle the creation of new pages in order to set the evaluateOnNewDocument for all of them? Is there an event to listen? Is there a way to set evaluateOnNewDocument for all new pages?
Issue Analytics
- State:
- Created 5 years ago
- Reactions:2
- Comments:6 (2 by maintainers)
Top Results From Across the Web
Page.evaluateOnNewDocument() method - Puppeteer
Adds a function which would be invoked in one of the following scenarios: ... The function is invoked after the document was created...
Read more >evaluateOnNewDocument on all new pages #7399 - GitHub
Puppeteer version: 9.1.1 Platform / OS version: Mac (M1) URLs (if applicable): Node.js version: v15.14.0 What steps will reproduce the ...
Read more >How to use evaluateOnNewDocument and exposeFunction?
On the other hand, page.evaluateOnNewDocument() evaluates a predefined function when a new document is created and before any of its scripts are executed....
Read more >How to use evaluateOnNewDocument function in Page
Promise which resolves to a new Page object. Page.goto. Navigates to a URL. Browser.close. Closes browser with all the pages (if any were...
Read more >Use evaluateOnNewDocument in Puppeteer With Examples
Learn how to use evaluateOnNewDocument function in Puppeteer framework for your next JavaScript automation project with LambdaTest Automation Testing ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@Vasile-Peste given that you re-opened this issue… Is there anything we (puppeteer team) can help you with?
@Vasile-Peste The sincerity anticipates your reply !