-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
I would like to run my PlayWright Java script in Chrome Incognito browser ... But it is not running in Incognito mode #31512
Comments
You don't need to specify the Does this help? |
@mxschmitt and @kiranbandaqa, I am also seeing that Chromium in Playwright is not truly incognito. When I launch my application in a Playwright test, with no cookies/origins set, I am presented with "Continue as User X". It recognizes me. Test cases to confirm this behavior is because Playwrights version of Chromium "isolated" is not the same as Chromium incognito.
While it runs as I would expect on the CI server, it should mirror my local runs. Especially if the browsers are truly isolated here. Its clear the issue lies in the fact some local credentials cache is being picked up when Chromium is not truly run in incognito mode, but I am at a loss as to how to prevent it from happening. Any ideas as to what might be wrong here, or guidance on getting parity between local Chromium |
@0x533435353447 where do you see "Continue as User X"? Could you provide us more details / screenshot? This would help us to reason about where this is coming from. From a website standpoint, in e.g. JavaScript, storage, like cookies etc. we are fully isolated - this is one of Playwrights core capabilities. (There is a known issue about AAD auth - maybe you are encountering this) |
Thanks @mxschmitt, the "Continue as User X" appears on one of our authentication/login systems that protects the application under test. Where X is the name of the user it has detected. So, But on my local machine, X is always me, unless I spin up a local incognito browser outside of Playwright.
We are not using AAD in this case. The authentication system is internal.
I've debugged the test, and peeked into cookies/storage and I'm not seeing anything. Is there a reason why Chromium does not appear to be in incognito mode when Playwright tests run? e.g. I would expect to see the Incognito badge in the browser menu bar as below. Passing |
Would love to learn more about this! So any screenshots / more details what this auth uses under the hood are appreciated.
Chromium recently changed the UI a bit, while it doesn't look like Incognito anymore, it is still incognito, see this lengthy discussion if you are curious. In a nutshell: nothing has changed the past few releases on a technicial perspective, only the Chromium UI doesn't make it look like incognito anymore. |
I'll try gather some more details on the flow of events and report back. |
@mxschmitt, after some further digging based on the link you sent, I've realized my problem is best described by #13954. I am in fact using an AAD enrolled machine and that was the culprit behind the login screen knowing more about me than expected! My solution per the linked issue was to pass in Is there a reason why |
if (browserName.equalsIgnoreCase("Chrome")) {
page = getBrowser(playwright, browserName)
.launch(new BrowserType.LaunchOptions()
.setHeadless(false)
.setChannel("chrome")
.setArgs(List.of("--start-maximized", "--incognito")))
.newContext(new Browser.NewContextOptions().setViewportSize(null))
.newPage();
The text was updated successfully, but these errors were encountered: