PlaywrightBrowserPlugin
Hierarchy
- BrowserPlugin- PlaywrightBrowserPlugin
 
Index
Methods
__aenter__
- Enter the context manager and initialize the browser plugin. - Returns BrowserPlugin
__aexit__
- Exit the context manager and close the browser plugin. - Parameters- exc_type: type[BaseException] | None
- exc_value: BaseException | None
- exc_traceback: TracebackType | None
 - Returns None
__init__
- Initialize a new instance. - Parameters- optionalkeyword-onlybrowser_type: BrowserType = 'chromium'- The type of browser to launch: - 'chromium', 'firefox', 'webkit': Use Playwright-managed browsers
- 'chrome': Use your locally installed Google Chrome browser. Requires Google Chrome to be installed on the system.
 
- optionalkeyword-onlyuser_data_dir: (str | Path) | None = None- Path to a User Data Directory, which stores browser session data like cookies and local storage. 
- optionalkeyword-onlybrowser_launch_options: dict[str, Any] | None = None- Keyword arguments to pass to the browser launch method. These options are provided directly to Playwright's - browser_type.launchmethod. For more details, refer to the Playwright documentation: https://playwright.dev/python/docs/api/class-browsertype#browser-type-launch.
- optionalkeyword-onlybrowser_new_context_options: dict[str, Any] | None = None- Keyword arguments to pass to the browser new context method. These options are provided directly to Playwright's - browser.new_contextmethod. For more details, refer to the Playwright documentation: https://playwright.dev/python/docs/api/class-browser#browser-new-context.
- optionalkeyword-onlymax_open_pages_per_browser: int = 20- The maximum number of pages that can be opened in a single browser instance. Once reached, a new browser instance will be launched to handle the excess. 
- optionalkeyword-onlyuse_incognito_pages: bool = False- By default pages share the same browser context. If set to True each page uses its own context that is destroyed once the page is closed or crashes. 
- optionalkeyword-onlyfingerprint_generator: FingerprintGenerator | None = None- An optional instance of implementation of - FingerprintGeneratorthat is used to generate browser fingerprints together with consistent headers.
 - Returns None
new_browser
- Create a new browser instance. - Returns BrowserController
Properties
active
Indicate whether the context is active.
AUTOMATION_LIBRARY
The name of the automation library that the plugin is managing.
browser_launch_options
Return the options for the browser.launch method.
Keyword arguments to pass to the browser launch method. These options are provided directly to Playwright's
browser_type.launch method. For more details, refer to the Playwright documentation:
https://playwright.dev/python/docs/api/class-browsertype#browser-type-launch.
browser_new_context_options
Return the options for the browser.new_context method.
Keyword arguments to pass to the browser new context method. These options are provided directly to Playwright's
browser.new_context method. For more details, refer to the Playwright documentation:
https://playwright.dev/python/docs/api/class-browser#browser-new-context.
browser_type
Return the browser type name.
max_open_pages_per_browser
Return the maximum number of pages that can be opened in a single browser.
A plugin for managing Playwright automation library.
It is a plugin designed to manage browser instances using the Playwright automation library. It acts as a factory for creating new browser instances and provides a unified interface for interacting with different browser types (chromium, firefox, webkit and chrome). This class integrates configuration options for browser launches (headless mode, executable paths, sandboxing, ...). It also manages browser contexts and the number of pages open within each browser instance, ensuring that resource limits are respected.