Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Java version of the Playwright testing and automation library

License

NotificationsYou must be signed in to change notification settings

microsoft/playwright-java

javadocmaven versionJoin Discord

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.

LinuxmacOSWindows
Chromium 141.0.7390.37
WebKit 26.0
Firefox 142.0.1

Documentation

https://playwright.dev/java/docs/intro

API Reference

https://playwright.dev/java/docs/api/class-playwright

Example

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")));        }      }    }  }}

Other languages

More comfortable in another programming language?Playwright is also available in


[8]ページ先頭

©2009-2025 Movatter.jp