microsoft / microsoft/playwright
[Bug]: Microsoft SAML login closes page on Edge since 1.60; adding --enable-automation fixes regression
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 96.4k
- Forks
- 6.5k
- Avg merge
- 1d 6h
- Merged PRs (30d)
- 180
Description
Version
1.60.0
Steps to reproduce
[Bug]: Microsoft SAML login closes page on Edge since 1.60; adding --enable-automation fixes regression
Version
Regression starts with Playwright 1.60.0.
1.59.1— ✅ works1.60.0— ❌ fails- later stable versions — ❌ fail
- latest
@next/ canary — ❌ fails 1.60.0with--enable-automationexplicitly added — ✅ works
Environment
- OS: Windows 10 win64
- Node.js: v22.13.0
- Browser: Microsoft Edge 151
- Browser configuration:
channel: 'msedge' - Edge is organization-managed through enterprise policies
- The same installed Edge binary/version is used for all Playwright versions tested
- Authentication: Microsoft Entra ID /
login.microsoftonline.comSAML flow - Playwright: Node.js / TypeScript
Description
After upgrading from Playwright 1.59.1 to 1.60.0, our Microsoft SAML authentication flow started closing the Playwright page immediately after the final Sign in action.
The application, machine and browser environment are unchanged.
The important finding is that explicitly restoring the Chromium/Edge launch argument:
--enable-automation
makes the authentication flow work again with Playwright 1.60.0.
This appears significant because --enable-automation was present in Playwright's Chromium launch arguments in 1.59.1 but is no longer present starting with 1.60.0.
Reproduction
Our Playwright configuration normally contains:
use: {
channel: 'msedge',
}
The test navigates through our application authentication flow to:
https://login.microsoftonline.com/...
and performs the Microsoft login.
Simplified example:
await page.getByLabel('Password').fill(password);
await page
.getByRole('button', { name: 'Sign in' })
.click();
With Playwright 1.59.1, Microsoft completes the SAML redirect back to the application normally.
With Playwright 1.60.0 and every newer version tested, the click itself succeeds, but shortly afterwards Playwright reports that the page has been closed.
For diagnostics I added:
page.on('close', () => {
console.log('PAGE CLOSED');
});
page.on('crash', () => {
console.log('PAGE CRASHED');
});
browser?.on('disconnected', () => {
console.log('BROWSER DISCONNECTED');
});
The observed event is:
PAGE CLOSED
The failure can subsequently surface as:
Target page, context or browser has been closed
depending on which Playwright operation is awaiting the page at that moment.
Originally this surfaced from waitForResponse(), but removing all response/token handling did not change the behavior. The page still closes after the Microsoft Sign in action.
Important finding / workaround
With Playwright 1.60.0, changing only the launch configuration to:
use: {
channel: 'msedge',
launchOptions: {
args: ['--enable-automation'],
},
}
fixes the issue.
The Microsoft SAML login and redirect then complete successfully.
Therefore the comparison is:
Same machine
Same managed Edge
Same Edge version
Same application
Same authentication flow
Playwright 1.59.1 PASS
Playwright 1.60.0 FAIL
Playwright > 1.60 FAIL
Playwright @next FAIL
Playwright 1.60.0 + --enable-automation PASS
I also tested whether the Edge-specific msForceBrowserSignIn feature was responsible by changing the corresponding --disable-features configuration.
That did not fix the issue.
Only restoring:
--enable-automation
has fixed it so far.
Expected behavior
Expected behavior
Microsoft SAML authentication should complete successfully after clicking Sign in, and the existing Edge page should continue the redirect back to the application without being closed.
This is the behavior observed with Playwright 1.59.1 and also with Playwright 1.60.0 when --enable-automation is explicitly restored.
Actual behavior
Actual behavior
Starting with Playwright 1.60.0, the page is closed during/after the Microsoft authentication redirect.
Adding --enable-automation restores the previous working behavior.
Additional context
The Microsoft Edge installation is controlled by organization enterprise policies, so changing the browser version is not possible.
However, this makes the regression comparison quite controlled: all Playwright versions are tested against the same Edge installation and version.
This seems potentially related to #41348, which reports a Playwright 1.60 regression around Microsoft Entra/OAuth cross-origin navigation and TargetClosedException.
The additional observation here is that the regression can be deterministically avoided by restoring --enable-automation.
It may be worth investigating whether removing --enable-automation in Playwright 1.60 changes Microsoft Edge behavior under enterprise policies during Entra/SAML authentication.
Additional context
No response
Environment
System:
OS: Windows 11 10.0.26100
CPU: (8) x64 Intel Xeon Processor (Cascadelake)
Memory: 16.48 GB / 31.88 GB
Binaries:
Node: 22.13.0 - C:\Program Files\nodejs\node.EXE
npm: 10.9.2 - C:\Program Files\nodejs\npm.CMD
IDEs:
VSCode: 1.100.0 - C:\Program Files\Microsoft VS Code\bin\code.CMD
npmPackages:
@playwright/test: ^1.60.0 => 1.60.0
playwright-bdd: ^9.2.0 => 9.2.0
playwright-mail-reporter: ^0.0.10 => 0.0.10
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by comparing Playwright 1.59.1 and 1.60.0 Chromium launch arguments, focusing on the removal of --enable-automation. Reproduce the Microsoft Entra ID SAML flow with channel: 'msedge' on the managed Edge environment, then verify that the page remains open and redirects successfully without manually adding the argument.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- testing-qa
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100