Rayrun
← Back to Discord Forum

Headed playwright not working at all after update

Trying to run headless: false in playwright 1.38 gives error: page closed

Full error: /home/path/node_modules/playwright-core/lib/server/chromium/crPage.js:377 this._firstNonInitialNavigationCommittedReject(new Error('Page closed')); ^

Error: Page closed at CRSession.<anonymous> (/home/path/node_modules/playwright-core/lib/server/chromium/crPage.js:377:54) at Object.onceWrapper (node:events:628:28) at CRSession.emit (node:events:526:35) at /home/path/node_modules/playwright-core/lib/server/chromium/crConnection.js:211:39

Node.js v20.5.1

This thread is trying to answer question "Why does running headless: false in playwright 1.38 give a 'page closed' error and how can it be fixed?"

5 replies

How is your config? Are you using PlaywrightTestConfig in the playwright.config.ts?

@apis3445: I am using playwright.config.js . Even if I spin up a new playwright project on my machine in a new dir the same happens

I am using playwright.config.js . Even if I spin up a new playwright project on my machine in a new dir the same happens

What is the code or the page that closes?

@apis3445: // playwright-extra is a drop-in replacement for playwright, // it augments the installed playwright with plugin functionality const { chromium } = require('playwright-extra') // Load the stealth plugin and use defaults (all tricks to hide playwright usage) // Note: playwright-extra is compatible with most puppeteer-extra plugins const stealth = require('puppeteer-extra-plugin-stealth')() // Add the plugin to playwright (any number of plugins can be added) chromium.use(stealth) // That's it, the rest is playwright usage as normal 😊 chromium.launch({ headless: true }).then(async browser => { const page = await browser.newPage() console.log('Testing the stealth plugin..') await page.goto('https://bot.sannysoft.com', { waitUntil: 'networkidle' }) await page.screenshot({ path: 'stealth.png', fullPage: true }) console.log('All done, check the screenshot. ✨') await browser.close() })

// playwright-extra is a drop-in replacement for playwright, // it augments the installed playwright with plugin functionality const { chromium } = require('playwright-extra')

// Load the stealth plugin and use defaults (all tricks to hide playwright usage) // Note: playwright-extra is compatible with most puppeteer-extra plugins const stealth = require('puppeteer-extra-plugin-stealth')()

// Add the plugin to playwright (any number of plugins can be added) chromium.use(stealth)

// That's it, the rest is playwright usage as normal 😊 chromium.launch({ headless: true }).then(async browser => { const page = await browser.newPage()

console.log('Testing the stealth plugin..') await page.goto('https://bot.sannysoft.com', { waitUntil: 'networkidle' }) await page.screenshot({ path: 'stealth.png', fullPage: true })

console.log('All done, check the screenshot. ✨') await browser.close() })

normal boilerplate, I discovered that I can make it run again if I do a fresh install on a vm, idfk man, it's probably just linux

Related Discord Threads

TwitterGitHubLinkedIn
AboutQuestionsDiscord ForumBrowser ExtensionTagsQA Jobs

Rayrun is a community for QA engineers. I am constantly looking for new ways to add value to people learning Playwright and other browser automation frameworks. If you have feedback, email luc@ray.run.