Skip to content

Replace async Playwright implementation with sync Playwright reimplementation - #726

Draft
nasif-z wants to merge 21 commits into
devfrom
playwright-actions-v2-pr
Draft

Replace async Playwright implementation with sync Playwright reimplementation#726
nasif-z wants to merge 21 commits into
devfrom
playwright-actions-v2-pr

Conversation

@nasif-z

@nasif-z nasif-z commented Sep 2, 2026

Copy link
Copy Markdown
Collaborator

Important Notes

  • This PR reverses the Playwright changes introduced by commits 45316e5, 2d05c5b, 1a02cbd, f77b0bb, and 0f07f81 before applying the replacement implementation.
  • Selenium remains the default web automation backend.

Summary/TLDR

  • Replace the previous async Playwright implementation with a Selenium-compatible Playwright action layer.
  • Preserve existing Selenium workflows while allowing Playwright to be selected at runtime.

Background

The dev branch already contains an earlier Playwright implementation. This branch first reverses that implementation, then adds the newer playwright-actions-v2 work so the two approaches are not combined accidentally.

What Was Added

  • A Playwright compatibility layer covering 55 existing Selenium-style actions.
  • Runtime routing through the zeuz_browser_driver shared variable.
  • Playwright support for locators, frames, tabs, dialogs, downloads, uploads, screenshots, network capture, and browser reuse.
  • A Selenium CDP bridge for Playwright-owned Chrome and Edge sessions.
  • Firefox and WebKit browser installation support.
  • Consolidated Playwright compatibility and configuration tests.

What Was Removed

  • The previous async Playwright action implementation and its supporting utilities.
  • Superseded Playwright tests and implementation documentation.

What Was Changed

  • Updated shared action routing, element lookup, browser lifecycle, timeout handling, and screenshot fallback behavior.
  • Preserved the dev branch browser-process cleanup while keeping Playwright operations on their thread-affine worker.
  • Updated Playwright documentation, dependencies, browser setup, and local screenshot configuration behavior.

How to Use

  • Set the zeuz_browser_driver shared variable to playwright to run compatible Selenium action rows with Playwright.
  • Existing Selenium behavior remains unchanged when the variable is not set.
  • Explicit playwright action rows can also be used.

How to Set Up

  • Install project dependencies normally.
  • Use the browser installer when bundled Playwright Firefox or WebKit support is needed.

Tests/Validation

A deployed test set run with ~100 test cases produced similar results with Selenium mode. But the execution speed was faster with Playwright.

  • PYTHONPATH=. uv --cache-dir /tmp/uv-cache run pytest tests/test_playwright_compat.py tests/test_config_module.py -q — 38 passed.
  • git diff --check origin/dev...HEAD — passed.

nasif-z added 19 commits August 23, 2026 16:19
- register 55 Playwright action declarations derived from the Selenium action set

- route explicit Playwright actions and runtime Selenium overrides while preserving default Selenium behavior

- keep Electron and accessibility workflows Selenium-owned with per-driver backend tracking

- implement synchronous browser lifecycle, navigation, tabs, frames, dialogs, downloads, uploads, forms, input, screenshots, JavaScript, tables, scrolling, and network capture

- extend shared element location for Playwright attributes, text matching, relationships, indexes, waits, saved locators, frames, and open shadow roots

- preserve Playwright thread affinity across action execution, timeouts, screenshots, DOM diagnostics, and teardown

- add the Playwright dependency lock, Firefox/WebKit installer registration, compatibility documentation, and Chrome-backed tests

- verify declaration parity, routing, timeout affinity, locator compatibility, and manual smoke behavior
- route unchanged Selenium conditional rows through the active browser backend
- resolve conditional elements with the Playwright page or current frame
- keep Playwright calls on the persistent action worker thread
- preserve default Selenium and explicit Playwright conditional routing
- add routing and thread-affinity regression coverage
- process default-content resets before selecting a requested iframe
- exclude reset directives from iframe locator construction
- clear stale frame and frame-stack state when wiring or navigating pages
- restore the shared browser driver to the main page before navigation
- add regression coverage for iframe switching and post-frame navigation
- expose a Selenium WebDriver attached to Playwright-owned Chrome and Edge
- provision and reuse a local Chromium CDP debugger endpoint
- publish the bridge through the existing selenium_driver contract
- switch bridge globals with Playwright driver IDs
- detach ChromeDriver before Playwright-owned browser teardown
- warn clearly for unsupported Firefox and WebKit sessions
- document attached-session limitations and add lifecycle regression coverage
- Normalize routed common-action rows so Selenium wait steps use Playwright timeouts.
- Preserve Selenium-compatible visibility for zero-height containers with visible descendants.
- Decode binary network request bodies safely without interrupting Playwright events.
- Apply configured viewport dimensions with a desktop-compatible fallback.
- Add routing, viewport, network, and visibility regression coverage.
- Document Playwright viewport behavior.
…wser Session Interoperability (#657)"

This reverts commit 2d05c5b.
@nasif-z nasif-z changed the title Replace legacy async Playwright implementation with compatible actions Replace async Playwright implementation with sync Playwright reimplementation Sep 2, 2026
@nasif-z nasif-z self-assigned this Sep 2, 2026
@nasif-z
nasif-z marked this pull request as draft September 2, 2026 10:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant