Skip to main content

fluxwright

Run hundreds of headless Chrome jobs on one machine, with a Playwright-style API. Each new_page is a fresh browser context on a pooled Chrome. The engine queues jobs when every slot is busy, restarts browsers before they bloat, and replaces browsers that crash.

Docs: https://fluxwright.vercel.app

Requires a local Chrome/Chromium binary (FLUXWRIGHT_CHROMIUM, CHROME, CHROMIUM, or a standard install path). For headless jobs, chrome-headless-shell is picked up from PATH or Puppeteer's/Playwright's cache and opens pages much faster: npx @puppeteer/browsers install chrome-headless-shell@stable.

Install

pip install fluxwright

Wheels cover Windows x64, macOS (Intel and Apple Silicon), and Linux (x86_64 and ARM64/aarch64), for Python 3.10 and newer. Anywhere else, pip builds from source, which needs Rust.

Use

asyncio:

import asyncio
from fluxwright.async_api import async_playwright

async def main():
    async with async_playwright() as p:
        browser = await p.chromium.launch(max_browsers=4)
        page = await browser.new_page()
        await page.goto("https://example.com")
        print(await page.get_by_role("heading").text_content())  # "Example Domain"
        print(await page.evaluate("() => location.hostname"))
        png = await page.screenshot(full_page=True)  # bytes
        await page.close()
        await browser.close()

asyncio.run(main())

Blocking code:

from fluxwright.sync_api import sync_playwright

with sync_playwright() as p:
    browser = p.chromium.launch()
    page = browser.new_page()
    page.goto("https://example.com")
    print(page.title())
    browser.close()

The names are Playwright's, so a Playwright script for the features below runs after changing playwright.async_api to fluxwright.async_api (or sync_api). chromium can also be imported directly: from fluxwright.async_api import chromium.

Many jobs at once: start them all and let the engine queue them.

async def job(browser, url):
    page = await browser.new_page()
    try:
        await page.goto(url)
        return await page.title()
    finally:
        await page.close()

titles = await asyncio.gather(*(job(browser, url) for url in urls))

The sync API runs every call on one event loop in a background thread, so its objects work from any thread: a ThreadPoolExecutor of jobs sharing one browser is fine (Playwright's sync API does not allow that).

API

Method What it does
chromium.launch(max_browsers=None, executable_path=None, headless=None, queue_timeout=None, memory_ceiling_mb=None, max_concurrency_per_host=None, min_delay_per_host=None, args=None, ignore_default_args=None, channel=None, prewarm_contexts=None) Start the pool: by default a browser per 4 CPUs with 8 pages each, and a memory budget (memory_ceiling_mb) of 75% of the memory free at launch: new pages wait while Chrome uses more. Headless uses chrome-headless-shell when installed (as Playwright does), else Chrome; FLUXWRIGHT_CHROMIUM, executable_path, or channel overrides. Customize Chromium flags with args / ignore_default_args and pre-warm blank slots with prewarm_contexts. When every slot is busy, new_page waits its turn however long the queue is, so starting every job at once works; with queue_timeout (ms) it raises TimeoutError after that long instead, counting a browser start when one is needed. For polite crawling, max_concurrency_per_host caps the pages on one host at once across the fleet and min_delay_per_host (ms) spaces the goto calls to it: a goto waits its turn
chromium.connect_over_cdp(endpoint_url) Connect to an already-running browser over CDP (ws://... or http://...) instead of launching local Chrome
browser.new_page(...) A fresh browser context. Every option applies to this page only: proxy={"server", "bypass", "username", "password"}, user_agent, locale, timezone_id, geolocation={"latitude", "longitude", "accuracy"} (with permissions=["geolocation"]), permissions, viewport={"width", "height"}, device_scale_factor, color_scheme, is_mobile, has_touch, extra_http_headers, ignore_https_errors, java_script_enabled, offline, base_url, http_credentials={"username", "password"}, bypass_csp, storage_state (a dict or a file path), record_har_path, record_har_omit_content, record_har_content, record_har_mode, record_har_url_filter, record_video_dir, record_video_size
browser.new_context(...) A context with new_page's options, as Playwright's new_context: multiple context.new_page() tabs and popups share cookies, storage, init scripts, exposed functions and routes; pages, tracing, request (APIRequestContext), route / unroute, route_from_har, add_init_script, expose_function, storage_state(path=None, indexed_db=False), cookies(urls=None), add_cookies(), clear_cookies(name=None, domain=None, path=None), new_cdp_session(page), close()
page.storage_state(path=None, indexed_db=False) Every cookie in the context plus localStorage (and IndexedDB when indexed_db=True) of the current origin, in Playwright's format. With path, also saved as JSON for new_page(storage_state=path)
page.goto(url, wait_until=None) Navigate. wait_until: load (default), domcontentloaded, networkidle, commit
page.title() / page.content() Read
page.click(selector, ...) / dblclick / hover / focus / blur / scroll_into_view_if_needed / drag_and_drop / tap Pointer actions (supporting button, click_count, delay, position, modifiers, force, trial) that scroll into view and wait until actionable. Selector: CSS, text=Foo, text="Exact", role=button[name="Save"]
page.fill(selector, value) / clear / press / press_sequentially / check / uncheck / set_checked / select_option / set_input_files Keyboard typing, shortcut chords (ControlOrMeta+a), checkboxes/radios/ARIA toggles, <select> options, and <input type="file"> uploads (paths or {name, mimeType, buffer})
page.mouse / page.keyboard / page.touchscreen Low-level pointer (move, down, up, click, dblclick, wheel), keyboard (down, up, press, type, insert_text), and touch (tap) controls in viewport CSS pixels
page.get_by_role(role, name=None, exact=None, checked=None, disabled=None, expanded=None, include_hidden=None, level=None, pressed=None, selected=None) / get_by_text / get_by_label / get_by_placeholder / get_by_alt_text / get_by_title / get_by_test_id / page.locator(selector, ...) Strict-mode Locator (strict=False optional on page.* shortcuts) with action, reader (text_content, inner_text, inner_html, input_value, get_attribute), bulk (count, all, all_text_contents, all_inner_texts), state (is_visible, is_hidden, is_enabled, is_disabled, is_checked, is_editable), bounding_box, screenshot, and evaluate. Supports xpath= / // / ..
locator.nth(i) / .first / .last / filter(has=..., has_not=..., has_text=..., has_not_text=...) / and_(other) / or_(other) Narrow or combine locators (has_text, has_not_text, and role name accept str or compiled regex)
page.frame_locator(iframe_selector) The same finders inside an iframe, same- or cross-origin; nest with .frame_locator()
page.frames / main_frame / frame(name=..., url=...) Imperative Frame handles (same-origin and cross-origin OOPIF): .url, .name, .page, is_detached(), .parent_frame, .child_frames, goto(), evaluate(), title(), content(), locators
page.on("popup", handler) / expect_popup / opener / bring_to_front Capture window.open() and target="_blank" popups sharing the page's context
page.evaluate(expression, arg=None) Runs JavaScript in the page and returns its JSON result, awaiting promises. A function ("(x) => x * 2") is called with arg; anything else is evaluated as is. A thrown error raises fluxwright.Error
page.screenshot(full_page=None, type=None, quality=None, clip=None, omit_background=None, path=None) PNG or JPEG bytes (inferred from path extension when type is omitted); clip crops {x, y, width, height}, omit_background clears the white background, also written to path
page.pdf(...) Render to PDF bytes (headless only): format, width/height (px, in, cm, mm or float px), margin, landscape, print_background, scale (0.1–2), page_ranges, prefer_css_page_size, display_header_footer, header_template, footer_template, outline, tagged, path
page.route(url, handler) / page.unroute(url, handler=None) / page.route_from_har(har, ...) Request interception (route.fulfill, route.fetch, route.continue_, route.abort, route.fallback) and HAR 1.2 replay/recording (url, not_found, update, update_mode, update_content)
page.on("websocket", handler) / expect_websocket Inspect WebSocket connections (ws.url, ws.is_closed(), ws.on("framesent" | "framereceived" | "socketerror" | "close"), ws.expect_event)
page.workers / page.on("worker", handler) / expect_worker Track and evaluate inside dedicated Web Workers (worker.url, worker.evaluate(...), worker.on("console" | "close"), worker.expect_event)
page.on("console" | "pageerror", handler) / once / remove_listener / expect_event Console messages (.type, .text) and uncaught errors (fluxwright.Error with .name, .message, .stack) as they happen
page.on("request" | "response" | "requestfinished" | "requestfailed", handler) Network traffic of the page, its popups and iframes: Request (.url, .method, .headers, .post_data, .resource_type, .failure) and Response (.status, .ok, .headers, .request, body(), text(), json())
page.expect_response(url_or_predicate, timeout=None) / expect_request with block: the first match from now on, a glob or regex for the URL or a function of the Response / Request; info.value is it. Default timeout 30 s
page.on("dialog", handler) Answer alert, confirm, prompt and beforeunload with dialog.accept(prompt_text) or dialog.dismiss(). Without a listener, or when no listener answers, a dialog is dismissed (beforeunload accepted), so the page never hangs
page.on("filechooser", handler) / page.expect_file_chooser(predicate=None, timeout=None) Intercept native file choosers opened by <input type="file">: file_chooser.is_multiple(), file_chooser.set_files(files)
page.expect_download(timeout=None) / page.wait_for_download(timeout=None) A finished download: .url, .suggested_filename, path(), save_as(path). expect_download waits for one the with block starts; wait_for_download also returns ones that finished before the call, oldest first. Files are deleted when the page closes. timeout=0 waits as long as it takes
page.console_messages() / page.page_errors() What the page, its popups and iframes logged, and the exceptions nothing caught, the last 1000 of each. Fail a job with assert await page.page_errors() == []
page.set_viewport_size({"width", "height"}) CSS-pixel viewport for this page
page.emulate_media(media=..., color_scheme=...) Changes CSS media ("screen" | "print" | None) and/or prefers-color-scheme ("light" | "dark" | "no-preference" | None)
page.wait_for_selector(selector, state=None, timeout=None) Waits until state: visible (the default), attached, hidden or detached, as in Playwright
page.aria_snapshot(...) / page.markdown(...) Compact ARIA accessibility tree with short @eN interactive refs (interactive_only, compact, max_depth, max_nodes; pass @eN to click / fill / locator) and clean HTML-to-Markdown extraction (selector, main_content_only, include_links, include_images)
expect(page | locator) Auto-retrying web-first assertions (to_be_visible, to_be_hidden, to_be_attached, to_be_enabled, to_be_disabled, to_be_checked, to_be_editable, to_have_text, to_contain_text, to_have_value, to_have_attribute, to_have_class, to_have_count, to_have_title, to_have_url, to_have_screenshot, not_to_*, plus expect.soft and soft_assertions) in both fluxwright.async_api and fluxwright.sync_api
context.tracing Playwright Trace Viewer-compatible .zip tracing (start(name=..., title=..., screenshots=True, snapshots=True), start_chunk(), stop_chunk(path=...), stop(path=...))
page.video Handle for per-page video recording enabled via record_video_dir / record_video_size (path(), save_as(path), delete(); WebM via ffmpeg or MJPEG-in-AVI fallback)
page.close() / browser.close() Dispose the context / shut down

Timeouts are in milliseconds, as in Playwright. goto, click, fill, wait_for_selector, screenshot and the locator actions take a per-call timeout= (0 for none), and page.set_default_timeout(ms) / page.set_default_navigation_timeout(ms) change the page's defaults (the engine's are 10 s for actions and 30 s for navigation). Errors are fluxwright.Error, and fluxwright.TimeoutError when something ran out of time.

End-to-end testing

fluxwright ships auto-retrying expect(), Playwright Trace Viewer-compatible .zip tracing, video recording, visual screenshot regression, and an auto-loaded pytest plugin (pytest11 entry point):

# test_example.py — run with:
# pytest --fluxwright-tracing=retain-on-failure --fluxwright-video=retain-on-failure
from fluxwright.sync_api import Page, expect

def test_homepage(page: Page) -> None:
    page.goto("https://example.com")
    expect(page).to_have_title("Example Domain")
    expect(page.get_by_role("heading")).to_have_text("Example Domain")
    expect(page).to_have_screenshot("home.png")  # --fluxwright-update-snapshots to update

Built-in pytest fixtures (playwright, browser_type, browser, context, page) reuse one pooled Chromium session and isolate each test in its own context. Useful CLI options: --headed, --base-url, --fluxwright-max-browsers, --fluxwright-output, --fluxwright-screenshot, --fluxwright-tracing, --fluxwright-video, and --fluxwright-update-snapshots.

Standalone tracing and video recording work in both sync_api and async_api:

from fluxwright.sync_api import expect, sync_playwright

with sync_playwright() as p:
    browser = p.chromium.launch(max_browsers=2)
    context = browser.new_context(record_video_dir="videos/")
    context.tracing.start(screenshots=True, snapshots=True)
    page = context.new_page()
    page.goto("https://example.com")
    expect(page.get_by_role("heading")).to_be_visible()
    context.tracing.stop(path="trace.zip")  # open with: npx playwright show-trace trace.zip
    video = page.video
    context.close()  # finalizes the video file
    video_path = video.path() if video else None
    browser.close()

Close pages when a job is done, in a finally, so a job that raises gives its slot back too:

page = await browser.new_page()
try:
    page.on("response", lambda r: print(page, r.status))
    await page.goto(url)
finally:
    await page.close()

Don't count on garbage collection instead. A page you drop is freed when Python collects it only if no page.on listener or page.route handler refers to the page, like the lambda above or a method of an object that holds the page: the page's pending event streams keep those handlers, and with them the page, alive, so its slot in the pool is never given back.

In the sync API, route handlers run on worker threads and each page's event listeners one at a time on that page's own thread, so both can call the page.

Develop

pip install maturin pytest
maturin develop   # needs Rust
pytest            # against a real Chrome

License

Licensed under the Apache License, Version 2.0.

Metadata

Release files for fluxwright 0.10.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for fluxwright 0.10.0
File Size Uploaded Provenance Actions
fluxwright-0.10.0.tar.gz 493.5 kB With provenance Details for fluxwright-0.10.0.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for fluxwright 0.10.0
File Actions
fluxwright-0.10.0-cp310-abi3-win_amd64.whl CPython 3.10 abi3 Windows x86-64 Details for fluxwright-0.10.0-cp310-abi3-win_amd64.whl
fluxwright-0.10.0-cp310-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl CPython 3.10 abi3 Linux glibc 2.17+ x86-64 Details for fluxwright-0.10.0-cp310-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
fluxwright-0.10.0-cp310-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl CPython 3.10 abi3 Linux glibc 2.17+ ARM64 Details for fluxwright-0.10.0-cp310-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
fluxwright-0.10.0-cp310-abi3-macosx_11_0_arm64.whl CPython 3.10 abi3 macOS 11.0+ ARM64 Details for fluxwright-0.10.0-cp310-abi3-macosx_11_0_arm64.whl
fluxwright-0.10.0-cp310-abi3-macosx_10_12_x86_64.whl CPython 3.10 abi3 macOS 10.12+ x86-64 Details for fluxwright-0.10.0-cp310-abi3-macosx_10_12_x86_64.whl

Total release size: 28.1 MB

Release files / fluxwright-0.10.0.tar.gz

Download URL fluxwright-0.10.0.tar.gz
Size 493.5 kB
Tags Source
SHA-256 checksum
How to use checksums
c6a28d9eaecaaa6fd2de31174172a1397701d16da817e0a487abe543062223dc
BLAKE2b-256 checksum
How to use checksums
99e1e42ae2c9b0a7d91df5824d83e645b777fcd126800189e00493a1430598f8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 22, 2026.

Transparency log

Release files / fluxwright-0.10.0-cp310-abi3-win_amd64.whl

Download URL fluxwright-0.10.0-cp310-abi3-win_amd64.whl
Size 5.4 MB
Tags CPython 3.10 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
f4ec0c249f90e8c603bd77edb3f777f6d3e0e159f9e20cbcf2b5e57e8e45ff34
BLAKE2b-256 checksum
How to use checksums
c3f02eebd7465a38575c95859588e25b2d97da5fdf01310f9bdb1440f3131cdb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 22, 2026.

Transparency log

Release files / fluxwright-0.10.0-cp310-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl

Download URL fluxwright-0.10.0-cp310-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Size 5.7 MB
Tags CPython 3.10 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
84443317411ac5607c8087529049f194b5f75d21bc18c577a59f79d0ee89457a
BLAKE2b-256 checksum
How to use checksums
0da00deb078320844c56194d08562d61418e9050a52008bf07ac45bb7dbf914f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 22, 2026.

Transparency log

Release files / fluxwright-0.10.0-cp310-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl

Download URL fluxwright-0.10.0-cp310-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
Size 6.0 MB
Tags CPython 3.10 Linux glibc 2.17+ ARM64 abi3
SHA-256 checksum
How to use checksums
73f0afb35a6fee8e8f6aa206b70028c4b09f8afecf81ad5bcc7aab80dfdcd5a3
BLAKE2b-256 checksum
How to use checksums
2ea43bf9ae4321bf785186e2ff424b6588568677c013945e8bb628b5ca8233e0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 22, 2026.

Transparency log

Release files / fluxwright-0.10.0-cp310-abi3-macosx_11_0_arm64.whl

Download URL fluxwright-0.10.0-cp310-abi3-macosx_11_0_arm64.whl
Size 5.2 MB
Tags CPython 3.10 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
f87ee86cbc2a79fcb69f7aeb195fb605c887b85aa55b5c7fb08ac01bfe0f98d1
BLAKE2b-256 checksum
How to use checksums
35a2c5ed73b582f8d0509d9c631d4aeff83a27fe3d36aa6adb3d208a519e7ca2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 22, 2026.

Transparency log

Release files / fluxwright-0.10.0-cp310-abi3-macosx_10_12_x86_64.whl

Download URL fluxwright-0.10.0-cp310-abi3-macosx_10_12_x86_64.whl
Size 5.3 MB
Tags CPython 3.10 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
4462e454d61b9a9efbba9e1d86af6a046b1dd533e104304eeb1e52bf9be66a01
BLAKE2b-256 checksum
How to use checksums
a15ee70828f89057af76f519256d2425f8239794e393870d628f722e3483d254
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 22, 2026.

Transparency log

Security for fluxwright 0.10.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 6 files in this release have been uploaded with provenance metadata.

Select from 6 files

Attestation for fluxwright-0.10.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 22, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page