PlaywrightEx.Browser (PlaywrightEx v0.2.0)
View SourceInteract with a Playwright Browser.
There is no official documentation, since this is considered Playwright internal.
References:
Summary
Functions
Closes the browser and all of its contexts.
Creates a new browser context. It won't share cookies/cache with other browser contexts.
Types
@type new_context_opt() :: {:timeout, timeout()} | {:accept_downloads, boolean()} | {:base_url, binary()} | {:bypass_csp, boolean()} | {:color_scheme, term()} | {:device_scale_factor, float()} | {:extra_http_headers, term()} | {:http_credentials, term()} | {:ignore_https_errors, boolean()} | {:is_mobile, boolean()} | {:java_script_enabled, boolean()} | {:locale, binary()} | {:user_agent, binary()} | {:viewport, term()}
Functions
@spec close(PlaywrightEx.guid(), [close_opt() | PlaywrightEx.unknown_opt()]) :: {:ok, any()} | {:error, any()}
Closes the browser and all of its contexts.
Reference: https://playwright.dev/docs/api/class-browser#browser-close
Options
:timeout(timeout/0) - Required. Maximum time for the operation (milliseconds).:reason(String.t/0) - The reason to be reported to the operations interrupted by the browser closure.
@spec new_context(PlaywrightEx.guid(), [ new_context_opt() | PlaywrightEx.unknown_opt() ]) :: {:ok, %{guid: PlaywrightEx.guid(), tracing: %{guid: PlaywrightEx.guid()}}} | {:error, any()}
Creates a new browser context. It won't share cookies/cache with other browser contexts.
Reference: https://playwright.dev/docs/api/class-browser#browser-new-context
Options
:timeout(timeout/0) - Required. Maximum time for the operation (milliseconds).:accept_downloads(boolean/0) - Whether to automatically download all the attachments. Defaults totrue.:base_url(String.t/0) - When usingPage.goto/3,Page.route/3,Page.wait_for_url/3, etc., it takes the base URL into consideration.:bypass_csp(boolean/0) - Toggles bypassing page's Content-Security-Policy. Defaults tofalse.:color_scheme- Emulates'prefers-colors-scheme'media feature. Defaults to:light.:device_scale_factor(float/0) - Specify device scale factor (can be thought of as dpr). Defaults to1.:extra_http_headers(term/0) - An object containing additional HTTP headers to be sent with every request.:http_credentials(term/0) - Credentials for HTTP authentication. Map with:usernameand:password.:ignore_https_errors(boolean/0) - Whether to ignore HTTPS errors when sending network requests. Defaults tofalse.:is_mobile(boolean/0) - Whether the meta viewport tag is taken into account and touch events are enabled. Defaults tofalse.:java_script_enabled(boolean/0) - Whether or not to enable JavaScript in the context. Defaults totrue.:locale(String.t/0) - Specify user locale, for exampleen-GB,de-DE, etc.:user_agent(String.t/0) - Specific user agent to use in this context.:viewport(term/0) - Sets a consistent viewport for each page. Map with:widthand:height, ornilto disable.