You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Playwright在Azure Pipeline运行MS Edge测试时浏览器安装失败问题

Azure Pipeline中Playwright安装MS Edge失败的解决办法

我平时用Chrome作为自动化测试的基础浏览器,偶尔会在本地对Firefox和MS Edge做跨浏览器测试。但配置Azure Pipeline执行跨浏览器测试时,MS Edge安装失败,先后出现两个错误:

第一个错误:

Error: browserType.launch: Chromium distribution 'msedge' is not found at C:\Users\tfs-build\AppData\Local\Microsoft\Edge\Application\msedge.exe
Run "npx playwright install msedge".

添加npx playwright install msedge命令后,出现第二个错误:

Downloading Microsoft Edge
Exception calling "DownloadFile" with "2" argument(s): "The request was aborted: Could not create SSL/TLS secure
channel."
At C:\agent2_work\16\s\node_modules\playwright-core\bin\reinstall_msedge_stable_win.ps1:8 char:1

  • $wc.Downloadfile($url, $msiInstaller)
  • + CategoryInfo          : NotSpecified: (:) [], ParentContainsErrorRecordException
      + FullyQualifiedErrorId : WebException
    
    

Failed to install browsers
Error: Failed to install msedge

解决步骤

  • 升级PowerShell TLS版本
    问题出在Azure Pipeline代理的PowerShell默认TLS版本不兼容,无法建立安全连接下载Edge安装包。在执行Playwright安装命令前,先运行以下PowerShell命令强制启用TLS 1.2:

    [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
    

    将这条命令放在npx playwright install msedge之前执行即可。

  • 使用预装Edge的托管代理
    若使用微软托管的Azure Pipeline代理,直接选择windows-latest镜像,这类官方镜像已经预装了MS Edge等主流浏览器,无需手动执行安装命令。

  • 离线安装Edge
    如果上述方法仍无效,可以手动下载Edge离线安装包,上传至Azure Artifacts或代理本地目录,修改Playwright安装脚本,指定本地安装包路径完成安装。

内容的提问来源于stack exchange,提问作者VINAY M

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.03 01:20:58