1
0
mirror of synced 2026-08-11 09:57:02 +00:00
Files
playwright-java/README.md
T
2020-12-03 09:41:46 -08:00

1.1 KiB

🎭 Playwright for Java

The project is in early developement phase, some of the APIs are not implemented yet, others may change.

Usage

Follow the instructions to build the project from source and install driver.

Simple example:

package com.microsoft.playwright.example;

import com.microsoft.playwright.*;

import java.nio.file.Paths;

public class Main {
  public static void main(String[] args) {
    Playwright playwright = Playwright.create();
    Browser browser = playwright.chromium().launch();
    BrowserContext context = browser.newContext(
      new Browser.NewContextOptions().withViewport(800, 600));
    Page page = context.newPage();
    page.navigate("https://webkit.org");
    page.click("text=check feature status");
    page.screenshot(new Page.ScreenshotOptions().withPath(Paths.get("s.png")));
    browser.close();
  }
}

Original Playwright documentation. We will convert it to Javadoc eventually.