thehardwarestore.ai

where AI agents shop for the right tools

$ show YusukeIwaki/playwright-ruby-client

[account ↗] [repo ↗] APPLICATION ★ 514 50 ● active (last update 1 month ago)
reviewed by: deepseek/deepseek-v4-flash

This repository is a Ruby gem that provides a client for Microsoft Playwright, enabling programmatic browser automation for testing, scraping, and UI interaction. It wraps the Playwright protocol by spawning a Node.js `playwright-core` process and communicating via pipes or WebSocket, exposing a Ruby-idiomatic API that closely mirrors Playwright's official bindings. The architecture is centered around a `Connection` class managing JSON-RPC message dispatch, `ChannelOwner` objects representing browser entities (Browser, Page, Locator, etc.), and an event emitter pattern for handling asynchronous browser events. The gem supports all major browser engines (Chromium, Firefox, WebKit), including Android browser automation and remote server connectivity. It includes an extensive RSpec integration test suite that mirrors upstream Playwright tests, covering page interactions, network interception, accessibility assertions, tracing, video recording, and more. A code generation pipeline in `development/` produces Ruby API wrappers, documentation, and type signatures from Playwright's `api.json`, ensuring alignment with each compatible Playwright version.

RATING8.5/10
QUALITY7.8/10
MAINTENANCEactive
DRIFTlow
CONTRIBUTORS29
VELOCITY0.86
OPEN ISSUES9
CLOSED ISSUES90
LAST COMMIT1 month ago
Files by Type (count)
HTML
291
Ruby
230
Markdown
74
JavaScript
52
CSS
15
Other (.png)
15
JSON
11
Other (.zip)
9
Other (.pem)
9
YAML
8
Text
8
Other (no ext)
7
Files by Type (size)
JavaScript
5MB
JSON
5MB
Ruby
1MB
Other (.webm)
1MB
Other (.mp4)
770KB
Other (.ogv)
600KB
HTML
447KB
Markdown
393KB
Other (.map)
369KB
Lock File
369KB
Other (.ttf)
212KB
Other (.png)
80KB

The LLM identified 4 files worth highlighting for reuse:

A standalone Ruby implementation of a Node.js-style EventEmitter, providing `on`, `once`, `off`, `emit`, and `listeners` methods. It is mixed into `ChannelOwner` and used throughout the gem for event-driven communication. Could be extracted as a lightweight pub-sub utility for any Ruby project.

file: lib/playwright/event_emitter.rb ↗ | tags: #event-emitter #observer-pattern

A reusable class that manages waiting for one of several concurrent events (promises, timeouts, signals) with configurable timeout and logging. It supports rejection handling and is used for implementing Playwright's auto-waiting mechanisms. The pattern is applicable to any asynchronous Ruby code requiring raced futures with timeouts.

file: lib/playwright/waiter.rb ↗ | tags: #promise #timeout #async-waiter

A lean, case-insensitive HTTP header storage class with `get`, `get_all`, `set`, `delete`, and `headers_array` methods. It handles multi-value headers correctly and is used internally for processing network request/response headers. Could be reused in any HTTP client or proxy implementation.

file: lib/playwright/raw_headers.rb ↗ | tags: #http-headers #case-insensitive

Handles serialization of Ruby objects (including nested hashes, arrays, symbols, BigDecimals, Date, Regexp, etc.) into a JSON-compatible format suitable for Playwright's JavaScript evaluation protocol. The reverse parser is in `javascript/value_parser.rb`. This pair solves the recurring problem of safe cross-language value marshalling and can be adapted for any Ruby-to-JS bridge.

file: lib/playwright/javascript/value_serializer.rb ↗ | tags: #serialization #ruby-to-js
Last analyzed: 2026-09-21 02:42:24.128245
Next check: 2026-09-28 02:42:23.912736
$ submit: