【问题标题】:unable to install playwright as a maven dependancy无法将 playwright 安装为 Maven 依赖项
【发布时间】:2022-08-11 19:43:39
【问题描述】:

我正在尝试使用 playwright 和 java 构建我的自动化框架,但是在运行测试时我遇到了以下问题。请指教!

Failed to install browsers
Error: Failed to download chromium v1000, caused by
Error: unable to get local issuer certificate
    at TLSSocket.onConnectSecure (node:_tls_wrap:1530:34)
    at TLSSocket.emit (node:events:390:28)
    at TLSSocket._finishInit (node:_tls_wrap:944:8)
    at TLSWrap.ssl.onhandshakedone (node:_tls_wrap:725:12)
Exception in thread \"main\" java.lang.RuntimeException: Failed to create driver
    at com.microsoft.playwright.impl.Driver.ensureDriverInstalled(Driver.java:61)
    at com.microsoft.playwright.impl.PlaywrightImpl.create(PlaywrightImpl.java:40)
    at com.microsoft.playwright.Playwright.create(Playwright.java:96)
    at com.microsoft.playwright.Playwright.create(Playwright.java:100)
    at Example.main(Example.java:5)
Caused by: java.lang.RuntimeException: Failed to install browsers, exit code: 1
    at com.microsoft.playwright.impl.DriverJar.installBrowsers(DriverJar.java:76)
    at com.microsoft.playwright.impl.DriverJar.initialize(DriverJar.java:48)
    at com.microsoft.playwright.impl.Driver.ensureDriverInstalled(Driver.java:57)
    ... 4 more

    标签: java maven playwright playwright-java


    【解决方案1】:

    我可以通过设置环境来禁用下载(因为它已经使用 npx playwright install 安装)来解决它

    PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1
    

    IntelliJ IDE 运行配置

    【讨论】:

      【解决方案2】:

      这不是剧作家或 Maven 的问题。你可以自己修。如果您只想避免问题而不是修复它,您可以遵循以下建议:https://community.claris.com/en/s/question/0D53w00005GuQXxCAN/nodejs-fmsapiclient-unable-to-verify-the-first-certificate-local-server 即通过将系统变量设置为零

      【讨论】:

      • 尽管得分为负,但答案本身是正确的。我对 gradle 也有同样的问题(不是 maven 或 gradle 没关系,但是 Playwright 二进制文件会抛出这个错误)并在一分钟内修复它
      猜你喜欢
      • 2014-07-29
      • 2014-05-13
      • 1970-01-01
      • 2017-04-21
      • 2016-02-06
      • 2020-05-26
      • 1970-01-01
      • 2021-05-29
      • 2018-09-11
      相关资源
      最近更新 更多