Skip to content

[Bug]: chromium.launch() implicitly invoke '--no-startup-window' to browser #32539

Description

@Fredida

Version

playwright-core 1.46.1 in node.js

Steps to reproduce

Launch external chromium browser with gui via following:

const browser = await chromium.launch(
        {
            channel: 'chrome',
            chromiumSandbox: true,
            executablePath: 'C:\\xxx\\chrome.exe',
            headless: false,
            args: [
                '--no-default-browser-check',
                '--disable-infobars',
                '--incognito',
            ]
        }
);

Expected behavior

Launch browser with gui(window) as headless has already been set false.

Actual behavior

The chromium browser was launched (process found, user data directory created) but no gui.

Additional context

If launch same chromium executeable with same options but using .launchPersistentContext():

const browser = await chromium.launchPersistentContext(
        'C:\\xxx\\userdata',
        {
            channel: 'chrome',
            chromiumSandbox: true,
            executablePath: 'C:\\xxx\\chrome.exe',
            headless: false,
            args: [
                '--no-default-browser-check',
                '--disable-infobars',
                '--incognito',
            ],
)

Browser window appears properly.

By adding DEBUG=pw:* as verbose:

Using .launch():

 pw:browser <launching> C:\xxx\chrome.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,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 --no-default-browser-check --disable-infobars --incognito --user-data-dir=C:\yyy\playwright_chromiumdev_profile-XXXXXX --remote-debugging-pipe --no-startup-window +0ms

Using .launchPersistentContext():

  pw:browser <launching> C:\xxx\chrome.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,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 --no-default-browser-check --disable-infobars --incognito --user-data-dir=C:\yyy\userdata --remote-debugging-pipe about:blank +0ms

The differene seems to be --no-startup-window in .launch().

BTW: May I suggest to add a feature that sets chromium user data directory in .lauch()? Althrough .launchPersistentContext() did this the .newContext() not existed in the launch browser. If we head to .launch(), the user data directory is always C:\AppData\Local\Temp\playwright-xxx , which is not easy to cleanup.

Environment

System: Windows 10 19044
Node: v20.12.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions