【发布时间】:2020-09-28 14:04:49
【问题描述】:
我想用铬代替铬。我可以通过提供可执行路径在 puppeteer 中实现相同的目标。在 playwright 中它不起作用,因为浏览器类型参数仅支持 'chromium, webkit, firefox'
const { chromium } = require('playwright');
(async () => {
const browser = await chromium.launch({
headless: false,
executablePath: '/Applications/Google Chrome.app/Contents/MacOS/Google Chrome',
});
const context = await browser.newContext();
const page = await context.newPage();
await page.goto('http://whatsmyuseragent.org/');
await page.screenshot({ path: `example-${browserType}.png` });
})();
【问题讨论】:
-
虽然这段代码是正确的,但 Playwright 依赖于 Chromium 上游的新变化,因此我建议使用 Chrome Canary 而不是 Chrome stable。你可以从这里获得 Canary:google.com/chrome/canary 让我知道这是否有效!
-
有效!问题是它应该始终是要安装在本地机器上的最新版本的 chrome/与 Playwright chromium 匹配的版本
-
+1 表示问题。我对如何使用特定版本的 chrome 进行测试有同样的问题,即79/80。
标签: javascript node.js webautomation playwright