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

Github Actions中Headful模式下Chromium无法加载扩展的问题

在GitHub Actions中测试Chrome扩展的问题及示例需求

场景与配置

我尝试使用GitHub Actions测试Chrome扩展,相关测试fixture设置代码如下:

extensionContext: async ({ exe_path }, use) => {
  const pathToExtension = path.join(__dirname, '..', 'build');
  const extensionContext = await chromium.launch({
    headless: false,
    args: [
      `--disable-extensions-except=${pathToExtension}`,
      `--load-extension=${pathToExtension}`,
    ],
    executablePath: exe_path,
  });
  await use(await extensionContext.newContext());
  await extensionContext.close();
},

通过Makefile在GitHub Actions中运行系统测试,执行命令:

xvfb-run --auto-servernum --server-args='-screen 0, 1920x1080x24' yarn run test --project=${BROWSER}

前置安装步骤:

yarn install --frozen-lockfile
yarn run playwright install --with-deps

遇到的问题

添加--disable-extensions-except标志时,chromium.launch会挂起,最终因30秒超时导致测试失败;移除该标志后Chromium能成功启动,但扩展并未加载(--load-extension标志仍保留)。

环境信息

  • Playwright版本:1.28.0
  • 操作系统:Linux(GitHub Actions的ubuntu-latest运行器)
  • Node.js版本:18.12.0
  • 浏览器:Chromium

需求

请问是否有在CI/CD框架(优先GitHub Actions)的Headful模式下测试Chrome扩展的可用示例?


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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.08.07 13:05:19