-
Notifications
You must be signed in to change notification settings - Fork 252
Description
System info
- Playwright Version: [1.40.0]
- Operating System: [macOS] (Not tested on other os. It is fair to assume this issue exists on all OS)
- Browser: [All]
- Other info:
Expected
The playwright drivers should be loaded and open the browser when running in an sbt plugin.
I am using playwright in an sbt plugin. It fails to load the driver with following error
Caused by: java.lang.NullPointerException: Cannot invoke "java.net.URL.toURI()" because the return value of "java.lang.ClassLoader.getResource(String)" is null
Actual
I am using playwright in an sbt plugin. It fails to load the driver with following error
Caused by: java.lang.NullPointerException: Cannot invoke "java.net.URL.toURI()" because the return value of "java.lang.ClassLoader.getResource(String)" is null
The root cause seems to be due to the way class loader is used in the DriverJar.Java
The function getDriverResourceURI()
is using a classloader from current Thread
ClassLoader classloader = Thread.currentThread().getContextClassLoader();
sbt is not able to provide all the libraries inthis class loader. It works with DriverJar.class.getClassLoader()
Can this function getDriverResourceURI()
be updated to use the class loader as in DriverJar.class.getClassLoader()
playwright-java/driver-bundle/src/main/java/com/microsoft/playwright/impl/driver/jar/DriverJar.java
Line 117 in e889b20
public static URI getDriverResourceURI() throws URISyntaxException { |