Support extensions with createIncognitoBrowserContext
See original GitHub issueSteps to reproduce
Tell us about your environment:
- Puppeteer version: ^1.6.2
- Platform / OS version: OSX
- Node.js version: v8.11.3
What steps will reproduce the problem?
Please include code that reproduces the issue.
- Use
createIncognitoBrowserContext
- Try to enable an extension using
--load-extension
and--disable-extensions-except
What is the expected result?
I expect the extension to work in incognito mode. This extension works well with Allow in incognito
switched on in Google Chrome, outside of Puppeteer.
What happens instead?
Got error net::ERR_BLOCKED_BY_CLIENT at chrome-extension://nkbihfbeogaeaoehlefnkodbefgpgknn/popup.html
Issue Analytics
- State:
- Created 5 years ago
- Reactions:3
- Comments:8 (1 by maintainers)
Top Results From Across the Web
Support extensions with createIncognitoBrowserContext #3442
I have a fully functional system using puppeteer and a custom plugin for deep testing / video recording, trying to cluster it now...
Read more >Use createIncognitoBrowserContext in Puppeteer With ...
Learn how to use createIncognitoBrowserContext function in Puppeteer framework for your next JavaScript automation project with LambdaTest Automation ...
Read more >Puppeteer: How to set the default browser context to incognito?
const context = await browser.createIncognitoBrowserContext(); const newContextPage: Page = await context.newPage(); newContextPage.goto("https ...
Read more >Puppeteer documentation - DevDocs
Puppeteer 7.1.0 API documentation with instant search, offline support, ... NOTE Extensions in Chrome / Chromium currently only work in non-headless mode.
Read more >API Reference — Pyppeteer 0.0.25 documentation
coroutine createIncognitoBrowserContext () → pyppeteer.browser.BrowserContext[source]¶ ... Headless mode doesn't support navigation to a PDF document.
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
Though ugly, it’s possible to use Puppeteer to drive the extensions page and enable extensions in incognito mode:
However I’m having more problems after that. I need to use
await browser.targets()
andawait target.page()
to grab a handle to one of my extensions’ background pages, and this is not working. After enabling this extension in incognito mode, it has 2 background pages, and the call toawait target.page()
for one of them just hangs and never returns anything.I’ve found a workaround for it. Pretty naive approach but it solves my problem 😃 What I do:
userDataDir: "./tmp"
tmp
dir totmp_ref
On each new browser instance I use this
tmp_ref
for my userDataDir. Browser history is in my case not an issue. Maybe it’s possible to compare the temporary files and check where those incognito settings are made.