Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ git clone https://github.com/microsoft/playwright-java
cd playwright-java
```

2. Run the following script to download and assemble the Playwright driver for all platforms into `driver-bundle/src/main/resources/driver/` directory (browser binaries for Chromium, Firefox and WebKit will be automatically downloaded later on first Playwright run).
2. Run the following script to download and assemble the Playwright driver for all platforms, one per module, into the `driver-bundle-<platform>/src/main/resources/driver/<platform>/` directories (browser binaries for Chromium, Firefox and WebKit will be automatically downloaded later on first Playwright run).

```bash
scripts/download_driver.sh
Expand Down
45 changes: 45 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,51 @@ public class PageScreenshot {
}
```

## Driver bundles and platform selection

Playwright ships the driver (a Node.js binary plus the `playwright-core` package) as
per-platform Maven artifacts. With **Maven**, the right one is selected automatically for the
machine that runs the build, so depending on `playwright` is all you need — no extra
configuration:

| Artifact | Platform |
| --- | --- |
| `driver-bundle-mac-x64` | macOS Intel |
| `driver-bundle-mac-arm64` | macOS Apple Silicon |
| `driver-bundle-linux-x64` | Linux x64 |
| `driver-bundle-linux-arm64` | Linux arm64 |
| `driver-bundle-win-x64` | Windows x64 |

### Bundling every platform (cross-platform / fat JARs)

The automatic selection picks the driver for the build host, so a JAR built on Linux contains
only the Linux driver. If you build on one OS and run on another (for example a distributable
fat JAR), depend on `driver-bundle-all`, which bundles every platform:

```xml
<dependency>
<groupId>com.microsoft.playwright</groupId>
<artifactId>driver-bundle-all</artifactId>
<version>${playwright.version}</version>
</dependency>
```

### Gradle

Gradle does not evaluate the Maven POM profiles that drive the automatic selection, so a Gradle
build will not pick a platform on its own (and converting the dependency from Maven does not
carry the selection over). Declare the driver explicitly — either a single platform:

```kotlin
runtimeOnly("com.microsoft.playwright:driver-bundle-linux-x64:$playwrightVersion")
```

or every platform:

```kotlin
runtimeOnly("com.microsoft.playwright:driver-bundle-all:$playwrightVersion")
```

## Other languages

More comfortable in another programming language? [Playwright](https://playwright.dev) is also available in
Expand Down
48 changes: 48 additions & 0 deletions driver-bundle-all/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.microsoft.playwright</groupId>
<artifactId>parent-pom</artifactId>
<version>1.50.0-SNAPSHOT</version>
</parent>

<artifactId>driver-bundle-all</artifactId>
<name>Playwright - Drivers For All Platforms</name>
<description>
Aggregates the Playwright driver for every supported platform (macOS, Linux and Windows).
Depend on this artifact when a single build must run on more than the host platform, for
example a cross-platform fat JAR. For the common case where only the host platform is needed,
rely on the transitive driver-bundle dependency, which selects the right platform automatically.
</description>

<dependencies>
<dependency>
<groupId>com.microsoft.playwright</groupId>
<artifactId>driver-bundle-mac-x64</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.microsoft.playwright</groupId>
<artifactId>driver-bundle-mac-arm64</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.microsoft.playwright</groupId>
<artifactId>driver-bundle-linux-x64</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.microsoft.playwright</groupId>
<artifactId>driver-bundle-linux-arm64</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.microsoft.playwright</groupId>
<artifactId>driver-bundle-win-x64</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
</project>
33 changes: 33 additions & 0 deletions driver-bundle-linux-arm64/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.microsoft.playwright</groupId>
<artifactId>parent-pom</artifactId>
<version>1.50.0-SNAPSHOT</version>
</parent>

<artifactId>driver-bundle-linux-arm64</artifactId>
<name>Playwright - Driver For Linux arm64</name>
<description>
Playwright driver (Node.js binary and playwright-core package) for the Linux arm64 platform.
This artifact is normally selected automatically for the host platform via the driver-bundle
module; depend on it directly (or on driver-bundle-all) to bundle additional platforms.
</description>

<build>
<plugins>
<!-- The driver binaries live in src/main/resources and must not be packaged
into the sources JAR (see issue #1913). -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<configuration>
<excludeResources>true</excludeResources>
</configuration>
</plugin>
</plugins>
</build>
</project>
2 changes: 2 additions & 0 deletions driver-bundle-linux-arm64/src/main/resources/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
driver/
local-driver/
33 changes: 33 additions & 0 deletions driver-bundle-linux-x64/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.microsoft.playwright</groupId>
<artifactId>parent-pom</artifactId>
<version>1.50.0-SNAPSHOT</version>
</parent>

<artifactId>driver-bundle-linux-x64</artifactId>
<name>Playwright - Driver For Linux x64</name>
<description>
Playwright driver (Node.js binary and playwright-core package) for the Linux x64 platform.
This artifact is normally selected automatically for the host platform via the driver-bundle
module; depend on it directly (or on driver-bundle-all) to bundle additional platforms.
</description>

<build>
<plugins>
<!-- The driver binaries live in src/main/resources and must not be packaged
into the sources JAR (see issue #1913). -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<configuration>
<excludeResources>true</excludeResources>
</configuration>
</plugin>
</plugins>
</build>
</project>
2 changes: 2 additions & 0 deletions driver-bundle-linux-x64/src/main/resources/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
driver/
local-driver/
33 changes: 33 additions & 0 deletions driver-bundle-mac-arm64/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.microsoft.playwright</groupId>
<artifactId>parent-pom</artifactId>
<version>1.50.0-SNAPSHOT</version>
</parent>

<artifactId>driver-bundle-mac-arm64</artifactId>
<name>Playwright - Driver For macOS arm64</name>
<description>
Playwright driver (Node.js binary and playwright-core package) for the macOS arm64 platform.
This artifact is normally selected automatically for the host platform via the driver-bundle
module; depend on it directly (or on driver-bundle-all) to bundle additional platforms.
</description>

<build>
<plugins>
<!-- The driver binaries live in src/main/resources and must not be packaged
into the sources JAR (see issue #1913). -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<configuration>
<excludeResources>true</excludeResources>
</configuration>
</plugin>
</plugins>
</build>
</project>
2 changes: 2 additions & 0 deletions driver-bundle-mac-arm64/src/main/resources/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
driver/
local-driver/
33 changes: 33 additions & 0 deletions driver-bundle-mac-x64/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.microsoft.playwright</groupId>
<artifactId>parent-pom</artifactId>
<version>1.50.0-SNAPSHOT</version>
</parent>

<artifactId>driver-bundle-mac-x64</artifactId>
<name>Playwright - Driver For macOS x64</name>
<description>
Playwright driver (Node.js binary and playwright-core package) for the macOS x64 platform.
This artifact is normally selected automatically for the host platform via the driver-bundle
module; depend on it directly (or on driver-bundle-all) to bundle additional platforms.
</description>

<build>
<plugins>
<!-- The driver binaries live in src/main/resources and must not be packaged
into the sources JAR (see issue #1913). -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<configuration>
<excludeResources>true</excludeResources>
</configuration>
</plugin>
</plugins>
</build>
</project>
2 changes: 2 additions & 0 deletions driver-bundle-mac-x64/src/main/resources/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
driver/
local-driver/
33 changes: 33 additions & 0 deletions driver-bundle-win-x64/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.microsoft.playwright</groupId>
<artifactId>parent-pom</artifactId>
<version>1.50.0-SNAPSHOT</version>
</parent>

<artifactId>driver-bundle-win-x64</artifactId>
<name>Playwright - Driver For Windows x64</name>
<description>
Playwright driver (Node.js binary and playwright-core package) for the Windows x64 platform.
This artifact is normally selected automatically for the host platform via the driver-bundle
module; depend on it directly (or on driver-bundle-all) to bundle additional platforms.
</description>

<build>
<plugins>
<!-- The driver binaries live in src/main/resources and must not be packaged
into the sources JAR (see issue #1913). -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<configuration>
<excludeResources>true</excludeResources>
</configuration>
</plugin>
</plugins>
</build>
</project>
2 changes: 2 additions & 0 deletions driver-bundle-win-x64/src/main/resources/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
driver/
local-driver/
Loading
Loading