# playwright-ruby-client > Ruby client for Playwright, including API reference and integration guides. This is a community-maintained Ruby client for Playwright. Important usage notes: - The gem does not include Node.js or Playwright. Install the compatible `playwright-core` npm package separately and pass `node_modules/.bin/playwright-core` to `Playwright.create`. - Determine the compatible Playwright version from `Playwright::COMPATIBLE_PLAYWRIGHT_VERSION`; do not assume the newest npm package is compatible. - Use playwright-ruby-client for native Playwright APIs. Use capybara-playwright-driver when compatibility with the Capybara DSL is more important. - Prefer the Ruby examples and signatures in this documentation over examples for other Playwright language bindings. ## Table of Contents - [Getting started](https://playwright-ruby-client.vercel.app/docs/article/getting_started.md): Install playwright-ruby-client with a compatible Playwright driver and run a first Ruby browser automation script. - [Install Playwright CLI](https://playwright-ruby-client.vercel.app/docs/article/guides/download_playwright_driver.md): `playwright-ruby-client` doesn't include Playwright. Install Node.js and the compatible `playwright-core` npm package in advance, then pass its CLI... - [Playwright inspector](https://playwright-ruby-client.vercel.app/docs/article/guides/inspector.md): Playwright provides a useful inspector. - [Launch Browser](https://playwright-ruby-client.vercel.app/docs/article/guides/launch_browser.md): Launch Chromium, Firefox, or WebKit from Ruby and configure browser launch options. - [Playwright on Alpine Linux](https://playwright-ruby-client.vercel.app/docs/article/guides/playwright_on_alpine_linux.md): **NOTE: This feature is EXPERIMENTAL.** - [Capybara driver for Ruby on Rails application](https://playwright-ruby-client.vercel.app/docs/article/guides/rails_integration.md): `playwright-ruby-client` is a client library just for browser automation, while Rails uses [Capybara](https://github.com/teamcapybara/capybara) for... - [Use Capybara without DSL](https://playwright-ruby-client.vercel.app/docs/article/guides/rails_integration_with_null_driver.md): Use native Playwright APIs in Rails system tests while retaining Capybara only for test server lifecycle management. - [Recording video](https://playwright-ruby-client.vercel.app/docs/article/guides/recording_video.md): Playwright allows us to record the browser screen during automation. - [Web-First assertions for RSpec](https://playwright-ruby-client.vercel.app/docs/article/guides/rspec_integration.md): Playwright introduces clever assertions for E2E testing, so called [web-first assertions](https://playwright.dev/docs/test-assertions). - [Semi-automation](https://playwright-ruby-client.vercel.app/docs/article/guides/semi_automation.md): Playwright Browser context is isolated and not persisted by default. But we can also use persistent browser context using [BrowserType#launch_persi... - [Reuse Cookie and LocalStorage](https://playwright-ruby-client.vercel.app/docs/article/guides/use_storage_state.md): In most cases, authentication state is stored in cookie or local storage. When we just want to keep authenticated, it is a good solution to dump/lo... - [Playwright](https://playwright-ruby-client.vercel.app/docs/api/playwright.md): Playwright module provides a method to launch a browser instance. The following is a typical example of using Playwright - [APIRequest](https://playwright-ruby-client.vercel.app/docs/api/api_request.md): Exposes API that can be used for the Web API testing. This class is used for creating - [APIRequestContext](https://playwright-ruby-client.vercel.app/docs/api/api_request_context.md): This API is used for the Web API testing. You can use it to trigger API endpoints, configure micro-services, prepare - [APIResponse](https://playwright-ruby-client.vercel.app/docs/api/api_response.md): [APIResponse](./api_response) class represents responses returned by [APIRequestContext#get](./api_request_context#get) and similar methods. - [Browser](https://playwright-ruby-client.vercel.app/docs/api/browser.md): A Browser is created via [BrowserType#launch](./browser_type#launch). An example of using a [Browser](./browser) to create a [Page](./page): - [BrowserContext](https://playwright-ruby-client.vercel.app/docs/api/browser_context.md): BrowserContexts provide a way to operate multiple independent browser sessions. - [BrowserType](https://playwright-ruby-client.vercel.app/docs/api/browser_type.md): BrowserType provides methods to launch a specific browser instance or connect to an existing one. The following is a - [CDPSession](https://playwright-ruby-client.vercel.app/docs/api/cdp_session.md): The [CDPSession](./cdp_session) instances are used to talk raw Chrome Devtools Protocol: - [Clock](https://playwright-ruby-client.vercel.app/docs/api/clock.md): Accurately simulating time-dependent behavior is essential for verifying the correctness of applications. Learn more about [clock emulation](https:... - [ConsoleMessage](https://playwright-ruby-client.vercel.app/docs/api/console_message.md): [ConsoleMessage](./console_message) objects are dispatched by page via the [`event: Page.console`] event. - [Credentials](https://playwright-ruby-client.vercel.app/docs/api/credentials.md): [Credentials](./credentials) is a virtual WebAuthn authenticator scoped to a [BrowserContext](./browser_context). It lets tests - [Dialog](https://playwright-ruby-client.vercel.app/docs/api/dialog.md): [Dialog](./dialog) objects are dispatched by page via the [`event: Page.dialog`] event. - [Download](https://playwright-ruby-client.vercel.app/docs/api/download.md): [Download](./download) objects are dispatched by page via the [`event: Page.download`] event. - [ElementHandle](https://playwright-ruby-client.vercel.app/docs/api/element_handle.md): - extends: [JSHandle](./js_handle) - [FileChooser](https://playwright-ruby-client.vercel.app/docs/api/file_chooser.md): [FileChooser](./file_chooser) objects are dispatched by the page in the [`event: Page.fileChooser`] event. - [Frame](https://playwright-ruby-client.vercel.app/docs/api/frame.md): At every point of time, page exposes its current frame tree via the [Page#main_frame](./page#main_frame) and - [FrameLocator](https://playwright-ruby-client.vercel.app/docs/api/frame_locator.md): FrameLocator represents a view to the `iframe` on the page. It captures the logic sufficient to retrieve the `iframe` and locate elements in that i... - [JSHandle](https://playwright-ruby-client.vercel.app/docs/api/js_handle.md): JSHandle represents an in-page JavaScript object. JSHandles can be created with the [Page#evaluate_handle](./page#evaluate_handle) - [Keyboard](https://playwright-ruby-client.vercel.app/docs/api/keyboard.md): Keyboard provides an api for managing a virtual keyboard. The high level api is [Keyboard#type](./keyboard#type), which takes - [Locator](https://playwright-ruby-client.vercel.app/docs/api/locator.md): Locators are the central piece of Playwright's auto-waiting and retry-ability. In a nutshell, locators represent - [LocatorAssertions](https://playwright-ruby-client.vercel.app/docs/api/locator_assertions.md): The LocatorAssertions class provides assertion methods for RSpec like `expect(locator).to have_text("Something")`. Note that we have to explicitly ... - [Mouse](https://playwright-ruby-client.vercel.app/docs/api/mouse.md): The Mouse class operates in main-frame CSS pixels relative to the top-left corner of the viewport. - [Page](https://playwright-ruby-client.vercel.app/docs/api/page.md): Page provides methods to interact with a single tab in a [Browser](./browser), or an - [PageAssertions](https://playwright-ruby-client.vercel.app/docs/api/page_assertions.md): The [PageAssertions](./page_assertions) class provides assertion methods that can be used to make assertions about the [Page](./page) state in the ... - [Request](https://playwright-ruby-client.vercel.app/docs/api/request.md): Whenever the page sends a request for a network resource the following sequence of events are emitted by [Page](./page): - [Response](https://playwright-ruby-client.vercel.app/docs/api/response.md): [Response](./response) class represents responses which are received by page. - [Route](https://playwright-ruby-client.vercel.app/docs/api/route.md): Whenever a network route is set up with [Page#route](./page#route) or [BrowserContext#route](./browser_context#route), the [Route](./route) object - [Selectors](https://playwright-ruby-client.vercel.app/docs/api/selectors.md): Selectors can be used to install custom selector engines. See [extensibility](https://playwright.dev/python/docs/extensibility) for more - [Touchscreen](https://playwright-ruby-client.vercel.app/docs/api/touchscreen.md): The Touchscreen class operates in main-frame CSS pixels relative to the top-left corner of the viewport. Methods on the - [Tracing](https://playwright-ruby-client.vercel.app/docs/api/tracing.md): API for collecting and saving Playwright traces. Playwright traces can be opened in [Trace Viewer](https://playwright.dev/python/docs/trace-viewer)... - [WebMCP](https://playwright-ruby-client.vercel.app/docs/api/web_mcp.md): [WebMCP](./web_mcp) exposes the tools that a frame registers through the experimental [WebMCP](./web_mcp) browser API, `navigator.modelContext`. It... - [WebSocket](https://playwright-ruby-client.vercel.app/docs/api/web_socket.md): The [WebSocket](./web_socket) class represents WebSocket connections within a page. It provides the ability to inspect and manipulate the data bein... - [WebStorage](https://playwright-ruby-client.vercel.app/docs/api/web_storage.md): WebStorage exposes the page's `localStorage` or `sessionStorage` for the current origin via an async, - [Worker](https://playwright-ruby-client.vercel.app/docs/api/worker.md): The Worker class represents a [WebWorker](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API). `worker` - [API Coverages](https://playwright-ruby-client.vercel.app/docs/article/api_coverage.md): `playwright-ruby-client` doesn't cover all of the Playwright APIs. The APIs listed below without strikethrough are available in `playwright-ruby-cl...