[Bug]: Target page, context or browser has been closed Browser
Version
1.50.1
Steps to reproduce
Get msedge package from following command:
npx [email protected] install --force msedge
Launching msedge:
var args = new List<string> {
"--no-sandbox",
"--disable-setuid-sandbox",
"--disable-dev-shm-usage",
"--disable-accelerated-2d-canvas",
"--no-first-run",
"--no-zygote",
"--process-per-site",
"--start-maximized",
"--disable-gpu"
};
if (launchChromeIncognitoMode)
{
args.Add("--incognito");
}
launchOptions.Args = args.ToArray();
var message = string.Empty;
if (browserType.IsAnaheim())
{
message = ".MicrosoftEdge";
launchOptions.ExecutablePath = Path.Combine(browsersPath, "msedge", "msedge-win", "msedge.exe");
}
browser = await playwright.Chromium.LaunchAsync(launchOptions);
}
Expected behavior
Msedge browser launching without exceptions.
Actual behavior
Microsoft.Playwright.TargetClosedException: Target page, context or browser has been closed Browser logs:
<launching> D:\app\Playwright.Browsers\msedge\msedge-win\msedge.exe --disable-field-trial-config --disable-background-networking --disable-background-timer-throttling --disable-backgrounding-occluded-windows --disable-back-forward-cache --disable-breakpad --disable-client-side-phishing-detection --disable-component-extensions-with-background-pages --disable-component-update --no-default-browser-check --disable-default-apps --disable-dev-shm-usage --disable-extensions --disable-features=ImprovedCookieControls,LazyFrameLoading,GlobalMediaControls,DestroyProfileOnBrowserClose,MediaRouter,DialMediaRouteProvider,AcceptCHFrame,AutoExpandDetailsElement,CertificateTransparencyComponentUpdater,AvoidUnnecessaryBeforeUnloadCheckSync,Translate,HttpsUpgrades,PaintHolding,ThirdPartyStoragePartitioning,LensOverlay,PlzDedicatedWorker --allow-pre-commit-input --disable-hang-monitor --disable-ipc-flooding-protection --disable-popup-blocking --disable-prompt-on-repost --disable-renderer-backgrounding --force-color-profile=srgb --metrics-recording-only --no-first-run --enable-automation --password-store=basic --use-mock-keychain --no-service-autorun --export-tagged-pdf --disable-search-engine-choice-screen --unsafely-disable-devtools-self-xss-warnings --headless --hide-scrollbars --mute-audio --blink-settings=primaryHoverType=2,availableHoverTypes=2,primaryPointerType=4,availablePointerTypes=4 --no-sandbox --no-sandbox --disable-setuid-sandbox --disable-dev-shm-usage --disable-accelerated-2d-canvas --no-first-run --no-zygote --process-per-site --start-maximized --disable-gpu --incognito --user-data-dir=D:\data --remote-debugging-pipe --no-startup-window
<launched> pid=11032
Call log:
- - <launching> D:\app\Playwright.Browsers\msedge\msedge-win\msedge.exe --disable-field-trial-config --disable-background-networking --disable-background-timer-throttling --disable-backgrounding-occluded-windows --disable-back-forward-cache --disable-breakpad --disable-client-side-phishing-detection --disable-component-extensions-with-background-pages --disable-component-update --no-default-browser-check --disable-default-apps --disable-dev-shm-usage --disable-extensions --disable-features=ImprovedCookieControls,LazyFrameLoading,GlobalMediaControls,DestroyProfileOnBrowserClose,MediaRouter,DialMediaRouteProvider,AcceptCHFrame,AutoExpandDetailsElement,CertificateTransparencyComponentUpdater,AvoidUnnecessaryBeforeUnloadCheckSync,Translate,HttpsUpgrades,PaintHolding,ThirdPartyStoragePartitioning,LensOverlay,PlzDedicatedWorker --allow-pre-commit-input --disable-hang-monitor --disable-ipc-flooding-protection --disable-popup-blocking --disable-prompt-on-repost --disable-renderer-backgrounding --force-color-profile=srgb --metrics-recording-only --no-first-run --enable-automation --password-store=basic --use-mock-keychain --no-service-autorun --export-tagged-pdf --disable-search-engine-choice-screen --unsafely-disable-devtools-self-xss-warnings --headless --hide-scrollbars --mute-audio --blink-settings=primaryHoverType=2,availableHoverTypes=2,primaryPointerType=4,availablePointerTypes=4 --no-sandbox --no-sandbox --disable-setuid-sandbox --disable-dev-shm-usage --disable-accelerated-2d-canvas --no-first-run --no-zygote --process-per-site --start-maximized --disable-gpu --incognito --user-data-dir=D:\data --remote-debugging-pipe --no-startup-window
- - <launched> pid=11032
at Microsoft.Playwright.Transport.Connection.InnerSendMessageToServerAsync[T](ChannelOwner object, String method, Dictionary`2 dictionary, Boolean keepNulls) in /_/src/Playwright/Transport/Connection.cs:206
at Microsoft.Playwright.Transport.Connection.WrapApiCallAsync[T](Func`1 action, Boolean isInternal) in /_/src/Playwright/Transport/Connection.cs:535
at Microsoft.Playwright.Core.BrowserType.LaunchAsync(BrowserTypeLaunchOptions options) in /_/src/Playwright/Core/BrowserType.cs:56
at Turanga.SessionManager.Providers.PlaywrightBrowserFactory.GetPlaywrightAndBrowser(String autopilotDeploymentToken, String mockUserAgent, BrowserType browserType, TestContext testContext, Boolean headless, Boolean launchChromeIncognitoMode, Int32 loadTimeoutInMilliseconds)
Additional context
No response
Environment
Windows
Does it work without specifying any args/executablePath? Why do you have msedge in a different location?
Tried using Channel = "msedge" to launch edge window and it is throwing "threw exception: Microsoft.Playwright.PlaywrightException: Chromium distribution 'msedge' is not found" exception. Is there anything else that can help?
You can install Edge via npx playwright install msedge - what does this yield to?
We are running test on an Azure VM with D series, and if needed we can login into machine to debug.
This does not answer the question - why does npx playwright install msedge not work / what does it yield to?
When trying to install using npx playwright install msedge I can see latest msedge binaries in C:\Program Files (x86)\Microsoft\Edge\Application and the following message:
║ ATTENTION: "msedge" is already installed on the system! ║ ║ ║ ║ "msedge" installation is not hermetic; installing newer version ║ ║ requires removal of a current installation first. ║ ║ ║ ║ To uninstall current version and re-install latest "msedge": ║ ║ ║ ║ - Close all running instances of "msedge", if any ║ ║ - Use "--force" to install browser: ║ ║ ║ ║ npx playwright install --force msedge ║ ║ ║ ║ <3 Playwright Team
I'll close it for now since it was verified in a private conversation that a normal fresh "npm init playwright" project with Edge works. So this is most likely related to the environment or way how you bundle Edge. This is outside of the scope for Playwright. We only look at global installed Edge versions.