puppeteer: slowMo + userDataDir = Error: Protocol error (Browser.close): Target closed.
Tell 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
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Reactions: 1
- Comments: 19 (6 by maintainers)
Commits related to this issue
- fix(Launcher): consume protocol errors when initiating browser.close() Handle errors property while sending Browser.close() Fixes #1429. — committed to aslushnikov/puppeteer by aslushnikov 6 years ago
- fix(Launcher): consume protocol errors when initiating browser.close() (#2332) Handle errors properly while sending Browser.close() Fixes #1429. — committed to puppeteer/puppeteer by aslushnikov 6 years ago
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.