allwright

API ReferenceJavaBrowser

Browser

Launch a Chromium or Firefox session through the static Allwright facade and hold the handle every other call goes through. Browser implements AutoCloseable, so try-with-resources closes it for you.

Allwright.chromium / Allwright.firefox

MethodSince v0.0.14

Returns the reusable BrowserType handle for launching that browser.

public static BrowserType chromium()
public static BrowserType firefox()

BrowserType.launch

MethodSince v0.0.14

Launches a browser of this type. Allwright.launchChrome()/launchFirefox() are equivalent shortcuts.

public Browser launch()
public Browser launch(LaunchOptions options)

Example

try (Browser browser = Allwright.firefox().launch()) {
  Page page = browser.page();
}

Browser.page / initialPage / initialTab

MethodSince v0.0.33

All three return the same initial Page opened at launch.

public Page page()
public Page initialPage()
public Page initialTab()

Browser.newPage / newTab

MethodSince v0.0.33

Opens a new browser context/tab and returns its Page. pages() returns a snapshot list of every open page.

public synchronized Page newPage()
public synchronized Page newPage(CommandOptions options)

Browser.close

MethodSince v0.0.14

Closes the browser session — called automatically at the end of a try-with-resources block.

public synchronized void close()

LaunchOptions

TypeSince v0.0.14

Launch-time options: a custom browser binary path and a launch timeout.

public record LaunchOptions(String browserBinary, Integer timeoutMs)