playwright: [BUG] cant create webkit context
Context:
- Playwright Version: 0.14.0
- Operating System: Fedora 31
- Node: v11.15.0
Code Snippet
I just used snippet from README.md
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();
}
})();
Describe the bug
It creates firefox and chrome screenshots, then falls:
$ node test.js
[(node:13203) UnhandledPromiseRejectionWarning: Error: Protocol error (Playwright.createContext): Browser has been closed.
at Promise (/home/Lightgazer/etc/code/playwright/node_modules/playwright-core/lib/webkit/wkConnection.js:102:63)
at new Promise [(<anonymous>)]
at WKSession.send (/home/Lightgazer/etc/code/playwright/node_modules/playwright-core/lib/webkit/wkConnection.js:101:16)
at WKBrowser.newContext (/home/Lightgazer/etc/code/playwright/node_modules/playwright-core/lib/webkit/wkBrowser.js:65:65)
at WKBrowser.<anonymous> (/home/Lightgazer/etc/code/playwright/node_modules/playwright-core/lib/helper.js:64:31)
at /home/Lightgazer/etc/code/playwright/test.js:6:35
(node:13203) 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:13203) [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.]
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 4
- Comments: 17 (5 by maintainers)
@Lightgazer fedora is not officially supported atm, so build’s crashing.
@thisguychris Focal (Ubuntu 20.04) is now officially supported since Playwright v1.3.0
@Philipp-M all our attempts here failed so far.
Everybody: Playwright v1.3.0 features a “launch doctor” that should print a nice error when some of the browsers miss a dependency and thus cannot launch. Hopefully, this should help battling the dependencies!
Hi, same error on Ubuntu 19.10
I’ve just encountered this bug on NixOS. Is it somehow possible to create a better sandboxed environment for the browser binaries? (At least) Chrome assumes that there are a lot of dependencies at specific file paths, which is prone to errors on the diverse Linux landscape.
Is it possible to statically link all dependencies to each browser executable (or bundle them within their directories) , for better sandboxing?
@Lightgazer and @selfrefactor and for people that may find this useful 👋 I’m using focal (20.04), there’s not libvpx5 package too since it’s been superseded by libvpx5.
Here’s what I did to fix the issue, I’ve downloaded libvpx5 package from Bionic
wget http://security.ubuntu.com/ubuntu/pool/main/libv/libvpx/libvpx5_1.7.0-3ubuntu0.18.04.1_amd64.debThen just install it
sudo apt install ./libvpx5_1.7.0-3ubuntu0.18.04.1_amd64.debHowever I still can’t open webkit with{ headless: false }I can only make it work with headlessI was able to make headful work. I’m using WSL2 / Ubuntu 20.04
So under
/usr/lib/x86_64-linux-gnuI just did a symlink
ln -s libffi.so.7.1.0 libffi.so.6and webkit now works!
I also experienced this when trying webkit on Ubuntu 18.04.4. It’d be nice with a better error message, but maybe that is not trivial as many dependencies can be missing?
@thisguychris Works!!! Thanks!! OS: Ubuntu 20.04 LTS
thisguychris’s fix solved my issue and I can now use WebKit with headless: false on Ubuntu 20.04
@thernstig, @anoop0567, for Ubuntu, I would recommend using our example Docker setup (which is based on Ubuntu) to find the missing dependencies.
@selfrefactor Webkit works on Linux, but I don’t think we’ve tried Manjaro. To debug this issue, you can use the DEBUG environment variable. Set it to
DEBUG=pw:browser*to see the missing dependencies while launching WebKit@arjun27 maybe also something for the new docs: Provide a list of dependencies and their naming for various Linux distributions (Fedora, CentOS, Debian based ones)