For AI agents: a documentation index is available at /llms.txt
Skip to main content

Async Page

A BAP page with generated methods and an event lifecycle.

add_cookies

add_cookies(cookies: Sequence[CookieInput]) -> CookieResponse

add_script_tag

add_script_tag(*, url: str | UnsetType = UNSET, path: str | Path | UnsetType = UNSET, content: str | UnsetType = UNSET, id: str | UnsetType = UNSET, type: str | UnsetType = UNSET) -> AddScriptTagResponse

add_style_tag

add_style_tag(*, url: str | UnsetType = UNSET, path: str | Path | UnsetType = UNSET, content: str | UnsetType = UNSET) -> AddStyleTagResponse

authenticate

authenticate(username: str, password: str, *, origin: str | UnsetType = UNSET) -> HTTPResponse | None

check

check(selector: str, *, scroll: bool | UnsetType = UNSET, timeout: float | UnsetType = UNSET, visible: bool | UnsetType = UNSET, wait: bool | UnsetType = UNSET) -> ClickResponse

click

click(selector: str, *, scroll: bool | UnsetType = UNSET, timeout: float | UnsetType = UNSET, visible: bool | UnsetType = UNSET, wait: bool | UnsetType = UNSET) -> ClickResponse

close

close() -> None

closed

Type: bool

content

content() -> str

cookies

cookies() -> list[StandardCookie]

emit

emit(event: str, payload: object) -> bool

emulate_media

emulate_media(type: MediaType) -> EmulateMediaTypeResponse

eval_on_selector

eval_on_selector(selector: str) -> str

eval_on_selector_all

eval_on_selector_all(selector: str, *, timeout: float | UnsetType = UNSET, wait: bool | UnsetType = UNSET) -> list[MapSelectorResponse]

evaluate

evaluate(expression: str, *, timeout: float | UnsetType = UNSET, url: str | UnsetType = UNSET) -> str | None

fulfill

fulfill(*, url: list[str] | UnsetType = UNSET, regex: list[str] | UnsetType = UNSET, method: list[Method] | UnsetType = UNSET, type: list[ResourceType] | UnsetType = UNSET, operator: OperatorType | UnsetType = UNSET, status: int | UnsetType = UNSET, content_type: str | UnsetType = UNSET, body: str | UnsetType = UNSET, base64_body: str | UnsetType = UNSET, headers: list[HeaderInput] | UnsetType = UNSET) -> FulfillResponse

go_back

go_back(*, timeout: float | UnsetType = UNSET, wait_until: WaitUntilHistory | UnsetType = UNSET) -> HTTPResponse | None

go_forward

go_forward(*, timeout: float | UnsetType = UNSET, wait_until: WaitUntilHistory | UnsetType = UNSET) -> HTTPResponse | None

goto

goto(url: str, *, timeout: float | UnsetType = UNSET, wait_until: WaitUntilGoto | UnsetType = UNSET, wait_until_all: list[WaitUntilGoto] | UnsetType = UNSET, referer: str | UnsetType = UNSET, referrer_policy: str | UnsetType = UNSET, remote_response_metadata: bool | UnsetType = UNSET) -> HTTPResponse | None

hover

hover(selector: str, *, scroll: bool | UnsetType = UNSET, timeout: float | UnsetType = UNSET, visible: bool | UnsetType = UNSET, wait: bool | UnsetType = UNSET, x: float | UnsetType = UNSET, y: float | UnsetType = UNSET) -> HoverResponse

html

html(*, selector: str | UnsetType = UNSET, timeout: float | UnsetType = UNSET, visible: bool | UnsetType = UNSET, clean: CleanInput | UnsetType = UNSET, rewrite: HTMLRewriteInput | UnsetType = UNSET) -> HTMLResponse

listener_count

listener_count(event: str) -> int

live_url

live_url(*, timeout: float | UnsetType = UNSET, interactable: bool | UnsetType = UNSET, type: LiveURLStreamType | UnsetType = UNSET, quality: int | UnsetType = UNSET, resizable: bool | UnsetType = UNSET, show_browser_interface: bool | UnsetType = UNSET, compressed: bool | UnsetType = UNSET, emulate_components: bool | UnsetType = UNSET) -> LiveURLResponse

load_secret

load_secret(ref: str, *, selector: str | UnsetType = UNSET) -> LoadSecretResponse

map_selector

map_selector(selector: str, *, timeout: float | UnsetType = UNSET, wait: bool | UnsetType = UNSET) -> list[MapSelectorResponse]

markdown

markdown(*, selector: str | UnsetType = UNSET, timeout: float | UnsetType = UNSET, visible: bool | UnsetType = UNSET) -> MarkdownResponse

off

off(event: EventName, listener: Listener) -> Self

on

on(event: EventName, listener: Listener) -> Self

once

once(event: EventName, listener: Listener) -> Self

pdf

pdf(*, display_header_footer: bool | UnsetType = UNSET, format: PDFPageFormat | UnsetType = UNSET, footer_template: str | UnsetType = UNSET, generate_document_outline: bool | UnsetType = UNSET, generate_tagged_pdf: bool | UnsetType = UNSET, landscape: bool | UnsetType = UNSET, print_background: bool | UnsetType = UNSET, omit_background: bool | UnsetType = UNSET, scale: float | UnsetType = UNSET, timeout: float | UnsetType = UNSET, wait_for_images: bool | UnsetType = UNSET, wait_for_fonts: bool | UnsetType = UNSET, full_page: bool | UnsetType = UNSET, width: float | str | UnsetType = UNSET, header_template: str | UnsetType = UNSET, height: float | str | UnsetType = UNSET, margin_bottom: float | str | UnsetType = UNSET, margin_left: float | str | UnsetType = UNSET, margin_right: float | str | UnsetType = UNSET, margin_top: float | str | UnsetType = UNSET, page_ranges: str | UnsetType = UNSET, prefer_css_page_size: bool | UnsetType = UNSET, transfer_mode: str | UnsetType = UNSET, path: str | UnsetType = UNSET) -> bytes

preferences

preferences(*, timeout: float | UnsetType = UNSET) -> DefaultResponse

proxy

proxy(*, network: ProxyNetwork | UnsetType = UNSET, country: CountryCode | UnsetType = UNSET, city: str | UnsetType = UNSET, state: str | UnsetType = UNSET, sticky: bool | UnsetType = UNSET, preset: str | UnsetType = UNSET, server: str | UnsetType = UNSET, method: list[Method] | UnsetType = UNSET, operator: OperatorType | UnsetType = UNSET, type: list[ResourceType] | UnsetType = UNSET, url: list[str] | UnsetType = UNSET) -> ProxyResponse

query_selector

query_selector(selector: str, *, timeout: float | UnsetType = UNSET, visible: bool | UnsetType = UNSET) -> ElementHandle | None

query_selector_all

query_selector_all(selector: str, *, timeout: float | UnsetType = UNSET, visible: bool | UnsetType = UNSET) -> list[ElementHandle]

reconnect

reconnect(*, timeout: float | UnsetType = UNSET) -> ReconnectionResponse

reject

reject(*, enabled: bool | UnsetType = UNSET, method: list[Method] | UnsetType = UNSET, operator: OperatorType | UnsetType = UNSET, type: list[ResourceType] | UnsetType = UNSET, url: list[str] | UnsetType = UNSET, regex: list[str] | UnsetType = UNSET) -> RejectResponse

reload

reload(*, timeout: float | UnsetType = UNSET, wait_until: WaitUntilHistory | UnsetType = UNSET) -> HTTPResponse | None

remove_all_listeners

remove_all_listeners(event: str | None = None) -> Self

request

request(*, type: list[ResourceType] | UnsetType = UNSET, method: list[Method] | UnsetType = UNSET, timeout: float | UnsetType = UNSET, url: list[str] | UnsetType = UNSET, wait: bool | UnsetType = UNSET, operator: OperatorType | UnsetType = UNSET) -> list[RequestResponse]

response

response(*, status: list[int] | UnsetType = UNSET, method: list[Method] | UnsetType = UNSET, operator: OperatorType | UnsetType = UNSET, timeout: float | UnsetType = UNSET, type: list[ResourceType] | UnsetType = UNSET, url: list[str] | UnsetType = UNSET, wait: bool | UnsetType = UNSET, body_encoding: bool | UnsetType = UNSET) -> list[ResponseResponse]

screenshot

screenshot(*, capture_beyond_viewport: bool | UnsetType = UNSET, clip: ScreenshotClip | UnsetType = UNSET, from_surface: bool | UnsetType = UNSET, full_page: bool | UnsetType = UNSET, omit_background: bool | UnsetType = UNSET, optimize_for_speed: bool | UnsetType = UNSET, quality: float | UnsetType = UNSET, selector: str | UnsetType = UNSET, type: ScreenshotType | UnsetType = UNSET, timeout: float | UnsetType = UNSET, wait_for_images: bool | UnsetType = UNSET, path: str | UnsetType = UNSET) -> bytes

scroll

scroll(*, selector: str | UnsetType = UNSET, through_page: bool | UnsetType = UNSET, timeout: float | UnsetType = UNSET, visible: bool | UnsetType = UNSET, wait: bool | UnsetType = UNSET, x: float | UnsetType = UNSET, y: float | UnsetType = UNSET) -> ScrollResponse

select_option

select_option(selector: str, value: str | Sequence[str]) -> SelectResponse

send

send(query: str, *, variables: Mapping[str, Any] | None = None, timeout: float | None = None) -> Any

set_content

set_content(html: str, *, timeout: float | UnsetType = UNSET, wait_until: WaitUntilHistory | UnsetType = UNSET, wait_until_all: list[WaitUntilHistory] | UnsetType = UNSET) -> HTTPResponse | None

set_extra_http_headers

set_extra_http_headers(headers: Mapping[str, str]) -> HTTPHeadersResponse

set_java_script_enabled

set_java_script_enabled(enabled: bool) -> JavaScriptResponse

set_user_agent

set_user_agent(user_agent: str) -> UserAgentResponse

set_viewport_size

set_viewport_size(*, width: float, height: float, device_scale_factor: float | UnsetType = UNSET, mobile: bool | UnsetType = UNSET, has_touch: bool | UnsetType = UNSET, landscape: bool | UnsetType = UNSET) -> ViewportResponse

solve

solve(*, type: CaptchaType | UnsetType = UNSET, timeout: float | UnsetType = UNSET, wait: bool | UnsetType = UNSET) -> CaptchaResponse

solve_image_captcha

solve_image_captcha(*, captcha_selector: str, input_selector: str, timeout: float | UnsetType = UNSET) -> CaptchaResponse

stop_session_recording

stop_session_recording() -> StopSessionRecordingResponse

subscribe

subscribe(listener: Listener) -> Callable[[], None]

Listen to every non-handshake raw transport frame.

switch_to_window

switch_to_window(*, url: str | UnsetType = UNSET, title: str | UnsetType = UNSET, newest: bool | UnsetType = UNSET, timeout: float | UnsetType = UNSET, wait_until: WaitUntilGoto | UnsetType = UNSET) -> SwitchWindowResponse

text

text(*, timeout: float | UnsetType = UNSET, selector: str | UnsetType = UNSET, visible: bool | UnsetType = UNSET, clean: CleanInput | UnsetType = UNSET) -> TextResponse

title

title() -> str

type

type(selector: str, text: str, *, delay: list[int] | UnsetType = UNSET, interactable: bool | UnsetType = UNSET, scroll: bool | UnsetType = UNSET, timeout: float | UnsetType = UNSET, visible: bool | UnsetType = UNSET, wait: bool | UnsetType = UNSET) -> TypeResponse

uncheck

uncheck(selector: str, *, scroll: bool | UnsetType = UNSET, timeout: float | UnsetType = UNSET, visible: bool | UnsetType = UNSET, wait: bool | UnsetType = UNSET) -> ClickResponse

url

url() -> str

wait_for_event

wait_for_event(event: str, *, timeout: float | UnsetType = UNSET) -> WaitForEvent

Wait for the next event payload, bounded by timeout when provided.

wait_for_function

wait_for_function(expression: str, *, polling: float | UnsetType = UNSET, polling_type: WaitForFunctionPolling | UnsetType = UNSET, timeout: float | UnsetType = UNSET, complete_on_promise_resolution: bool | UnsetType = UNSET) -> WaitForFunction

wait_for_navigation

wait_for_navigation(*, timeout: float | UnsetType = UNSET, wait_until: WaitUntilGoto | UnsetType = UNSET) -> HTTPResponse

wait_for_network_idle

wait_for_network_idle(*, idle_time: float | UnsetType = UNSET, concurrency: int | UnsetType = UNSET, timeout: float | UnsetType = UNSET) -> WaitForTimeoutResponse

wait_for_request

wait_for_request(url: str | UnsetType = UNSET, *, method: Method | UnsetType = UNSET, operator: OperatorType | UnsetType = UNSET, timeout: float | UnsetType = UNSET) -> WaitForRequestResponse

wait_for_response

wait_for_response(url: str | UnsetType = UNSET, *, statuses: Sequence[int] | UnsetType = UNSET, codes: Sequence[int] | UnsetType = UNSET, operator: OperatorType | UnsetType = UNSET, timeout: float | UnsetType = UNSET) -> WaitForResponseResponse

wait_for_selector

wait_for_selector(selector: str, *, timeout: float | UnsetType = UNSET, visible: bool | UnsetType = UNSET, hidden: bool | UnsetType = UNSET) -> WaitForSelectorResponse

wait_for_timeout

wait_for_timeout(ms: float) -> None

watch_event

watch_event(event: str) -> WaitForEvent

Start tracking event now so a later wait_for_event call can return immediately if that event has already fired.