- Notifications
You must be signed in to change notification settings - Fork250
Java version of the Playwright testing and automation library
License
NotificationsYou must be signed in to change notification settings
microsoft/playwright-java
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
🎭Playwright for Java
Playwright is a Java library to automateChromium,Firefox andWebKit with a single API. Playwright is built to enable cross-browser web automation that isever-green,capable,reliable andfast.
Linux | macOS | Windows | |
---|---|---|---|
Chromium 141.0.7390.37 | ✅ | ✅ | ✅ |
WebKit 26.0 | ✅ | ✅ | ✅ |
Firefox 142.0.1 | ✅ | ✅ | ✅ |
https://playwright.dev/java/docs/intro
https://playwright.dev/java/docs/api/class-playwright
This code snippet navigates to Playwright homepage in Chromium, Firefox and WebKit, and saves 3 screenshots.
importcom.microsoft.playwright.*;importjava.nio.file.Paths;importjava.util.Arrays;importjava.util.List;publicclassPageScreenshot {publicstaticvoidmain(String[]args) {try (Playwrightplaywright =Playwright.create()) {List<BrowserType>browserTypes =Arrays.asList(playwright.chromium(),playwright.webkit(),playwright.firefox() );for (BrowserTypebrowserType :browserTypes) {try (Browserbrowser =browserType.launch()) {BrowserContextcontext =browser.newContext();Pagepage =context.newPage();page.navigate("https://playwright.dev/");page.screenshot(newPage.ScreenshotOptions().setPath(Paths.get("screenshot-" +browserType.name() +".png"))); } } } }}
More comfortable in another programming language?Playwright is also available in
About
Java version of the Playwright testing and automation library
Topics
Resources
License
Code of conduct
Contributing
Security policy
Uh oh!
There was an error while loading.Please reload this page.