module Playwright::BrowserType

Overview

BrowserType provides methods to launch a specific browser instance or connect to an existing one. The following is a typical example of using Playwright to drive automation:

Defined in:

playwright/browsertype.cr

Instance Method Summary

Instance Method Detail

abstract def executable_path : String #

A path where Playwright expects to find a bundled browser executable.


[View source]
abstract def launch(options : LaunchOptions?) : Browser #

Returns the browser instance. You can use ignoreDefaultArgs to filter out --mute-audio from default arguments:

Chromium-only Playwright can also be used to control the Chrome browser, but it works best with the version of Chromium it is bundled with. There is no guarantee it will work with any other version. Use executablePath option with extreme caution. If Google Chrome (rather than Chromium) is preferred, a Chrome Canary or Dev Channel build is suggested. In browserType.launch([options]) above, any mention of Chromium also applies to Chrome. See this article for a description of the differences between Chromium and Chrome. This article describes some differences for Linux users.


[View source]
def launch : Browser #

[View source]
abstract def launch_persistent_context(user_data_dir : Path, options : LaunchPersistentContextOptions?) : BrowserContext #

Returns the persistent browser context instance. Launches browser that uses persistent storage located at userDataDir and returns the only context. Closing this context will automatically close the browser.


[View source]
def launch_persistent_context(user_data_dir : Path) : BrowserContext #

[View source]
abstract def name : String #

Returns browser name. For example: 'chromium', 'webkit' or 'firefox'.


[View source]