question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

slowMo + userDataDir = Error: Protocol error (Browser.close): Target closed.

See original GitHub issue

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.

  1. use options slowMo and userDataDir together
  2. 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:

  1. Error: Protocol error (Browser.close): Target closed.
  2. AssertionError [ERR_ASSERTION]: false == true

2017-11-20 20 28 29

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:19 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
aslushnikovcommented, Apr 7, 2018

There are good chances this will be fixed as the upstream patch lands: https://chromium-review.googlesource.com/c/chromium/src/+/1000730

1reaction
hclj37commented, Nov 25, 2017

@aslushnikov I have also tested with Windows 7, same issue. While puppeteer/.local-chromium binary worked ok for me.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found