Skip to content
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

[BUG] browserType.launch: Target page, context or browser has been closed #286

Open
arbengers opened this issue Jul 22, 2024 · 3 comments
Open
Labels
bug Something isn't working

Comments

@arbengers
Copy link

arbengers commented Jul 22, 2024

Environment

  • chromium Version: 126.0.0
  • playwright-core Version: 1.45.2
  • Node.js Version: nodejs20.x
  • Lambda Runtime: nodejs20.x

Expected Behavior

Launch the browser, chromium

Current Behavior

Error: browserType.launch: Target page, context or browser has been closed

<launching> /tmp/chromium --disable-field-trial-config --disable-background-networking --enable-features=NetworkService,NetworkServiceInProcess --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 --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 --allow-pre-commit-input --disable-background-networking --disable-background-timer-throttling --disable-backgrounding-occluded-windows --disable-breakpad --disable-client-side-phishing-detection --disable-component-extensions-with-background-pages --disable-component-update --disable-default-apps --disable-dev-shm-usage --disable-extensions --disable-hang-monitor --disable-ipc-flooding-protection --disable-popup-blocking --disable-prompt-on-repost --disable-renderer-backgrounding --disable-sync --enable-automation --enable-blink-features=IdleDetection --export-tagged-pdf --force-color-profile=srgb --metrics-recording-only --no-first-run --password-store=basic --use-mock-keychain --disable-domain-reliability --disable-print-preview --disable-speech-api --disk-cache-size=33554432 --mute-audio --no-default-browser-check --no-pings --single-process --font-render-hinting=none --disable-features=Translate,BackForwardCache,AcceptCHFrame,MediaRouter,OptimizationHints,AudioServiceOutOfProcess,IsolateOrigins,site-per-process --enable-features=NetworkServiceInProcess2,SharedArrayBuffer --hide-scrollbars --ignore-gpu-blocklist --in-process-gpu --window-size=1920,1080 --use-gl=angle --use-angle=swiftshader --allow-running-insecure-content --disable-setuid-sandbox --disable-site-isolation-trials --disable-web-security --no-sandbox --no-zygote --headless='shell' --user-data-dir=/tmp/playwright_chromiumdev_profile-XXXXXXENN9kd --remote-debugging-pipe --no-startup-window

Steps to Reproduce

import chromium from '@sparticuz/chromium';
import { chromium as chromiumPw } from 'playwright-core';

async handleMessage(records: any) {
        for (const record of records) {
            console.log(`Cognito Data: ${JSON.stringify(data)}`);
            try {
               const browser = await chromiumPw.launch({
                    headless: true,
                    args: chromium.args,
                    executablePath: await chromium.executablePath(),
                });
                const context = await browser.newContext();
                const page = await context.newPage();
                await page.goto('https://some_domain.com');
                // HTML Content
                const pageContent = await page.content();
                // Text Content
                const textContent = await page.evaluate(() => document.body.innerText);
                
            } catch (err) {
                console.log(err);
            }
        }
    }
@arbengers arbengers added the bug Something isn't working label Jul 22, 2024
@arbengers arbengers changed the title [BUG] [BUG] browserType.launch: Target page, context or browser has been closed Jul 22, 2024
@gscpw
Copy link

gscpw commented Sep 27, 2024

Any workarounds?

@gscpw
Copy link

gscpw commented Sep 27, 2024

I have downgraded to @sparticuz/chromium v123 and playwright-core at ~1.42.0 and I no longer experience this issue.

@xmimiex
Copy link

xmimiex commented Nov 23, 2024

Nothing else to do ? we can't use the latest versions ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants