Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature]: Allow launching in incognito mode #8836

Closed
stevenwdv opened this issue Aug 24, 2022 · 8 comments
Closed

[Feature]: Allow launching in incognito mode #8836

stevenwdv opened this issue Aug 24, 2022 · 8 comments
Assignees
Labels

Comments

@stevenwdv
Copy link

Currently, puppeteer.launch opens a non-incognito context, and while one can open an incognito context via createIncognitoBrowserContext, this seems like an unnecessary hassle, especially since an extra context was created (and remains open).
Chromium supports launching in incognito mode via -incognito, but specifying this in puppeteer.launch let's Puppeteer still think that it's a non-incognito context: isIncognito returns false, which may cause some problems.

It would be nice to have a documented way of doing this, via a boolean option in puppeter.launch.

@jrandolf
Copy link
Contributor

This sounds very reasonable. I suppose we can add a small check that sees if the launch arguments contains incognito and flips the flag appropriately. Would that suffice?

@stevenwdv
Copy link
Author

stevenwdv commented Aug 26, 2022

I don't know the ins and outs, but if that's all it takes to properly set up an incognito session, you could do that. Although I think having a boolean would be a nicer way, and this could also be made compatible with Firefox (disclaimer: I haven't used puppeteer with FF so idk if you'd also use launch for that).

@jrandolf
Copy link
Contributor

Hmm, now that I think about it, it would still only be a heuristic since someone could use a custom-chrome binary which defaults to incognito (as if someone would do that). I'll take a look at Firefox and come up with some solutions.

@jrandolf jrandolf self-assigned this Aug 26, 2022
@OrKoN
Copy link
Collaborator

OrKoN commented Sep 2, 2022

I think it's actually a bug in Puppeteer which assumes that the default browser context is non-incognito. It should probably derive it from the actual running browser context. The entire isIncognito check in Puppeteer does not look very robust.

@stevenwdv
Copy link
Author

@OrKoN Don't you mean "assumes that the default browser context is *non-*incognito" ?

@jacty
Copy link

jacty commented Sep 3, 2022

Maybe we can prioritize the context created by user instead of using the default one? When user specified, no default one will be created?

@OrKoN
Copy link
Collaborator

OrKoN commented Sep 5, 2022

the default one is created by the browser itself and it is not explicitly created by Puppeteer.

@OrKoN
Copy link
Collaborator

OrKoN commented Feb 21, 2024

Closing in favor of #11686 We want to get rid of relying on the term "incognito" as it is Chrome-specific and instead we will only report if a given context is the default one or if it was created via Puppeteer's https://pptr.dev/api/puppeteer.browser.createbrowsercontext/ (where the word incognito has already been dropped).

@OrKoN OrKoN closed this as not planned Won't fix, can't repro, duplicate, stale Feb 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants