检查包是否需要更新:
npm outdated @playwright/test
Playwright updade 可以通过运行进行:
npm i @playwright/test
通常在 Playwright 更新后,浏览器需要更新:
npx playwright install
常见问题
如果在 Playwright 版本更新后未执行命令 npx playwright install,并且测试运行如下:
npx playwright test
然后 Playwright 会自动识别旧浏览器,抛出错误并建议安装更新的浏览器。
browserType.launch: Executable doesn't exist at
C:Users estAppDataLocalms-playwrightchromium-1041chrome-winchrome.exe
╔═════════════════════════════════════════════════════════════════════════╗
║ Looks like Playwright Test or Playwright was just installed or updated. ║
║ Please run the following command to download new browsers: ║
║ ║
║ npx playwright install ║
║ ║
║ <3 Playwright Team ║
╚═════════════════════════════════════════════════════════════════════════╝
没有关于更新/升级的官方文档,请参阅https://github.com/microsoft/playwright/issues/12179。
有关安装的有用命令:
-
检查编剧版本:
npx @playwright/test --version
-
更新到特定版本
npm install @playwright/test@1.28
-
更新到 Canary 版本(下一个版本,每天发布,将其视为测试版)docs
npm install @playwright/test@next