【问题标题】:How to update / upgrade Playwright?如何更新/升级剧作家?
【发布时间】:2023-02-15 14:09:22
【问题描述】:

Node.js 项目中更新/升级Playwright 的正确方法是什么?
我试图在官方文档中找到它,但没有找到任何具体内容。

即我有这个简单的项目:

{
  "name": "cool-tests",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {},
  "keywords": [],
  "author": "",
  "license": "ISC",
  "devDependencies": {
    "@playwright/test": "^1.28.1"
  }
}

使用最新的Playwright 版本以及兼容的浏览器维护该项目的最佳方式是什么?

【问题讨论】:

    标签: node.js playwright


    【解决方案1】:

    您可以npm i @playwright/test@latest 获取最新版本

    然后npx playwright install 安装浏览器。

    【讨论】:

      【解决方案2】:

      检查包是否需要更新:

      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
        

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2022-01-01
        • 2021-02-19
        • 2021-08-02
        • 2022-12-06
        • 2021-12-04
        • 2020-06-15
        • 2023-01-13
        • 1970-01-01
        相关资源
        最近更新 更多