unable to install playwright as a maven dependancy

2.6k Views Asked by At

I'm trying to build my automation framework using playwright with java, however I'm running into below issue when running the tests. Please advice!

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
2

There are 2 best solutions below

1
On

It's not a Playwright or Maven problem. You can fix it yourself. If you want just to avoid the problem, not fixing it, you can follow this recommendation: https://community.claris.com/en/s/question/0D53w00005GuQXxCAN/nodejs-fmsapiclient-unable-to-verify-the-first-certificate-local-server namely by setting the system variable to zero

0
On

I could solve it by disabling the download (as it was already installed with npx playwright install) by setting the env

PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1

IntelliJ IDE Run Configuration

enter image description here