我将通过说我不太了解puppeteer来作为开头,但似乎playwright被创建为它的继承者,所以我想我将直接跳过使用它。
[使用此guide,我试图配置Karma和Protractor,就像我将puppeteer
只替换为playwright
时,告诉我将puppeteer
放在哪里一样。
此行
process.env.CHROME_BIN = require('playwright').executablePath();
但是不起作用,因为playwright
本身没有exectablePath()
函数
相反,我尝试过
process.env.CHROME_BIN = require('playwright').chromium.executablePath()
这似乎可以满足我的要求。但是我仍然收到以下错误消息。尝试运行ng test --watch=false
40% building 84/84 modules 0 active15 02 2020 20:41:52.310:INFO [launcher]: Trying to start ChromeHeadless again (2/2).
15 02 2020 20:41:52.360:ERROR [launcher]: Cannot start ChromeHeadless
/workspace/vr2k2/node_modules/playwright-core/.local-chromium/linux-740847/chrome-linux/chrome: error while loading shared libraries: libX11-xcb.so.1: cannot open shared object file: No such file or directory
15 02 2020 20:41:52.360:ERROR [launcher]: ChromeHeadless stdout:
15 02 2020 20:41:52.361:ERROR [launcher]: ChromeHeadless stderr: /workspace/vr2k2/node_modules/playwright-core/.local-chromium/linux-740847/chrome-linux/chrome: error while loading shared libraries: libX11-xcb.so.1: cannot open shared object file: No such file or directory
15 02 2020 20:41:52.436:ERROR [launcher]: ChromeHeadless failed 2 times (cannot start). Giving up.
任何人都有关于如何使用playwright
设置Angular的更好的资源?
错误字符串显示Chromium无法找到共享库(libx11
)。这通常意味着您的系统缺少系统依赖性。如果您使用的是Ubuntu,则可以将this list of system dependencies用于3个捆绑的浏览器。