Skip to content

[Bug]: Microsoft SAML login closes page on Edge since 1.60; adding --enable-automation fixes regression #42379

Description

@NikkTod

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 — ✅ works
  • 1.60.0 — ❌ fails
  • later stable versions — ❌ fail
  • latest @next / canary — ❌ fails
  • 1.60.0 with --enable-automation explicitly 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.com SAML 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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions