Install git, Java JDK (version >= 8), Maven (tested with version 3.6.3), on Ubuntu 20.04 just run the following command:
sudo apt-get install git openjdk-11-jdk maven unzip
- Clone this repository
git clone https://github.com/microsoft/playwright-java
cd playwright-java
- Run the following script to download 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).
scripts/download_driver.sh
mvn compile
mvn test
# Executing a single test
BROWSER=chromium mvn test --projects=playwright -Dtest=TestPageNetworkSizes#shouldHaveTheCorrectResponseBodySize
# Executing a single test class
BROWSER=chromium mvn test --projects=playwright -Dtest=TestPageNetworkSizes
Public Java API is generated from api.json which is produced by print-api-json
command of playwright CLI. To regenerate Java interfaces for the current driver run the following commands:
./scripts/download_driver.sh
./scripts/generate_api.sh
Versions of published driver archives can be found in publish canary and publish release actions logs. To update the driver to a particular version run the following command:
scripts/roll_driver.sh [version]
- We try to follow Google Java Style Guide
- Comments should be generally avoided. If the code would not be understood without comments, consider re-writing the code to make it self-explanatory.
All submissions, including submissions by project members, require review. We use GitHub pull requests for this purpose. Consult GitHub Help for more information on using pull requests.
Commit messages should follow the Semantic Commit Messages format:
label(namespace): title
description
footer
- label is one of the following:
fix
- playwright bug fixes.feat
- playwright features.docs
- changes to docs, e.g.docs(api.md): ..
to change documentation.test
- changes to playwright tests infrastructure.devops
- build-related work, e.g. CI related patches and general changes to the browser build infrastructurechore
- everything that doesn't fall under previous categories
- namespace is put in parenthesis after label and is optional. Must be lowercase.
- title is a brief summary of changes.
- description is optional, new-line separated from title and is in present tense.
- footer is optional, new-line separated from description and contains "fixes" / "references" attribution to github issues.
Example:
fix(firefox): make sure session cookies work
This patch fixes session cookies in firefox browser.
Fixes #123, fixes #234
This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.opensource.microsoft.com.
When you submit a pull request, a CLA bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.
This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.