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.

[Question] I encounter an error while using playwright

See original GitHub issue

Hello,

I ran few scripts on my computer with no problem but when I tried them on my server I encountered this problem :

(node:6134) UnhandledPromiseRejectionWarning: Error: Protocol error (Target.getBrowserContexts): Target closed.

It happens when I try to launch the browser.

Full length message :

(node:6134) UnhandledPromiseRejectionWarning: Error: Protocol error (Target.getBrowserContexts): Target closed.
    at /opt/docker-test/master-ci/Ami/tests/playwright/node_modules/playwright-core/lib/chromium/crConnection.js:121:63
    at new Promise (<anonymous>)
    at CRSession.send (/opt/docker-test/master-ci/Ami/tests/playwright/node_modules/playwright-core/lib/chromium/crConnection.js:120:16)
    at Function.connect (/opt/docker-test/master-ci/Ami/tests/playwright/node_modules/playwright-core/lib/chromium/crBrowser.js:48:68)
    at async Chromium.launch (/opt/docker-test/master-ci/Ami/tests/playwright/node_modules/playwright-core/lib/server/chromium.js:45:25)
    at async /opt/docker-test/master-ci/Ami/tests/playwright/test.js:5:25
(node:6134) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:6134) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

My code :

const playwright = require('playwright');

(async () => {
	  for (const browserType of ['chromium', 'firefox', 'webkit']) {
		      const browser = await playwright[browserType].launch();
		      const context = await browser.newContext();
		      const page = await context.newPage();
		      await page.goto('http://whatsmyuseragent.org/');
		      await page.screenshot({ path: `example-${browserType}.png` });
		      await browser.close();
		    }
})();

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:10 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
pavelfeldmancommented, Feb 11, 2020

Another debugging tip is to use launch({dumpio: true}). That prints browser output and helps debugging browser start issues. Could you try that our and send us logs if any? Thanks!

1reaction
pavelfeldmancommented, Feb 11, 2020

Also, https://github.com/microsoft/playwright/blob/master/.travis.yml has dependencies our Travis bots install to run Playwright

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to config drone to fail the Playwright pipeline only on any ...
I fixed this problem by creating 2 different "playwright.config.ts" files. The 1st file uses the 1st set of browsers and the 2nd file...
Read more >
Answers to All The Top Questions For Playwright Testing
All the top answers to your favorite questions on the hottest new testing ... Q: Can we see what errors look like when...
Read more >
playwright._impl._api_types.error: execution context was ...
I came into this issue today, and found that this problem occurs in this case: I was use page object loading a url...
Read more >
How to Fix the ERR_CONNECTION_REFUSED Error in Chrome
When you visit a website using Google Chrome and encounter this message, it means that your attempt to connect was refused. This error...
Read more >
How to start with Playwright Debugging | BrowserStack
Validate the code for a successful fix of the error. How to Debug Playwright Tests? One of the key features of Playwright is...
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