slowMo + userDataDir = Error: Protocol error (Browser.close): Target closed.
See original GitHub issueTell us about your environment:
- Puppeteer version: 0.13.0
- Platform / OS version: macOS 10.13.1
- URLs (if applicable): https://www.google.com/ (any URLs)
What steps will reproduce the problem?
Please include code that reproduces the issue.
- use options
slowMo
anduserDataDir
together browser.close()
the code:
const path = require('path')
const puppeteer = require('puppeteer')
const run = async () => {
const browser = await puppeteer.launch({
headless: false,
slowMo: 250,
userDataDir: path.join(process.cwd(), 'state'),
})
const page = await browser.newPage()
await page.goto('https://www.google.com/')
await browser.close()
}
run()
What is the expected result?
close the browser with no exception
What happens instead?
throw UnhandledPromiseRejectionWarning:
Error: Protocol error (Browser.close): Target closed.
AssertionError [ERR_ASSERTION]: false == true
Issue Analytics
- State:
- Created 6 years ago
- Reactions:1
- Comments:19 (6 by maintainers)
Top Results From Across the Web
slowMo + userDataDir = Error: Protocol error (Browser.close ...
use options slowMo and userDataDir together; browser.close(). the code: ... Error: Protocol error (Browser.close): Target closed.
Read more >Error: Protocol error (Performance.enable): Target closed
I am running an application for auto-login into Amazon and Walmart but sometimes the script is throwing protocol error.
Read more >slowMo + userDataDir = Error: Protocol error (Browser.close): Target ...
slowMo + userDataDir = Error: Protocol error (Browser.close): Target closed.
Read more >Puppeteer documentation - DevDocs
Puppeteer is a Node library which provides a high-level API to control Chromium or Chrome over the DevTools Protocol. The Puppeteer API is...
Read more >Error - Target closed - Checkly
Our script can return the sometimes cryptic “Target closed” error. Knowing that the “target” is normally our browser, the context or tab that...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
There are good chances this will be fixed as the upstream patch lands: https://chromium-review.googlesource.com/c/chromium/src/+/1000730
@aslushnikov I have also tested with Windows 7, same issue. While
puppeteer/.local-chromium
binary worked ok for me.