Skip to content

API Reference parrot_tools.scraping.drivers.page_driver

github-actions[bot] edited this page Dec 2, 2026 · 4 revisions

parrot_tools.scraping.drivers.page_driver

View source

PageDriver — a lightweight AbstractDriver over a single Playwright Page.

FlowExecutor creates one Playwright Page per node (from a session-scoped BrowserContext) and wraps it in a :class:PageDriver so it can be handed to execute_plan_steps (which only speaks AbstractDriver).

Unlike :class:PlaywrightDriver, this adapter owns neither the browser nor the context — start() is a no-op and quit() closes only the wrapped page (FEAT-222, Module 6).

Alias AbstractDriver

Re-exported from parrot_tools.scraping.drivers.abstract.AbstractDriver.

Class PageDriver

Adapt a live Playwright Page to the :class:AbstractDriver interface.

Parameter Type Default Description
page Any A live Playwright Page (already created within a BrowserContext).

Attributes:

Attribute Type Description
current_url str The URL of the wrapped page.

Method PageDriver.start

No-op: the page is already alive when handed to this adapter.

start() -> None

Method PageDriver.quit

Close the wrapped page (not the context or browser).

quit() -> None

Method PageDriver.navigate

Navigate to url.

navigate(url: str, timeout: int = 30) -> None

Parameter Type Default Description
url str
timeout int 30

Method PageDriver.go_back

Navigate back in history.

go_back() -> None

Method PageDriver.go_forward

Navigate forward in history.

go_forward() -> None

Method PageDriver.reload

Reload the current page.

reload() -> None

Method PageDriver.click

Click the element matching selector.

click(selector: str, timeout: int = 10) -> None

Parameter Type Default Description
selector str
timeout int 10

Method PageDriver.fill

Fill the input matching selector with value.

fill(selector: str, value: str, timeout: int = 10) -> None

Parameter Type Default Description
selector str
value str
timeout int 10

Method PageDriver.select_option

Select an option in a <select> element.

select_option(selector: str, value: str, *, by: str = 'value', timeout: int = 10) -> None

Parameter Type Default Description
selector str
value str
by str 'value'
timeout int 10

Method PageDriver.hover

Hover over the element matching selector.

hover(selector: str, timeout: int = 10) -> None

Parameter Type Default Description
selector str
timeout int 10

Method PageDriver.press_key

Press a keyboard key.

press_key(key: str) -> None

Parameter Type Default Description
key str

Method PageDriver.get_page_source

Return the full HTML of the current page.

get_page_source() -> str

Returns: str

Method PageDriver.get_text

Return the inner text of the first matching element.

get_text(selector: str, timeout: int = 10) -> str

Parameter Type Default Description
selector str
timeout int 10

Returns: str

Method PageDriver.get_attribute

Return the value of attribute on the matching element.

get_attribute(selector: str, attribute: str, timeout: int = 10) -> Optional[str]

Parameter Type Default Description
selector str
attribute str
timeout int 10

Returns: Optional[str]

Method PageDriver.get_all_texts

Return the inner text of every matching element.

Waits for the first match to appear before collecting, matching :class:PlaywrightDriver so dynamically-loaded lists are not silently returned empty.

get_all_texts(selector: str, timeout: int = 10) -> List[str]

Parameter Type Default Description
selector str
timeout int 10

Returns: List[str]

Method PageDriver.screenshot

Take a screenshot and save it to path.

screenshot(path: str, full_page: bool = False) -> bytes

Parameter Type Default Description
path str
full_page bool False

Returns: bytes

Method PageDriver.type_text

Type keystrokes into a selected or currently focused element.

type_text(text: str, selector: Optional[str] = None, delay_ms: int = 0, clear_first: bool = False, timeout: int = 10) -> None

Parameter Type Default Description
text str
selector Optional[str] None
delay_ms int 0
clear_first bool False
timeout int 10

Method PageDriver.screenshot_element

Capture a PNG of a selected element and save it to path.

screenshot_element(selector: str, path: str, timeout: int = 10) -> bytes

Parameter Type Default Description
selector str
path str
timeout int 10

Returns: bytes

Method PageDriver.wait_for_selector

Wait until selector reaches state.

wait_for_selector(selector: str, timeout: int = 10, state: str = 'visible') -> None

Parameter Type Default Description
selector str
timeout int 10
state str 'visible'

Method PageDriver.wait_for_navigation

Wait for navigation/network to settle.

wait_for_navigation(timeout: int = 30) -> None

Parameter Type Default Description
timeout int 30

Method PageDriver.wait_for_load_state

Wait until the page reaches the given load state.

wait_for_load_state(state: str = 'load', timeout: int = 30) -> None

Parameter Type Default Description
state str 'load'
timeout int 30

Method PageDriver.execute_script

Execute JavaScript with arguments in the page context.

execute_script(script: str, *args: Any) -> Any

Parameter Type Default Description
script str
*args Any ()

Returns: Any

Method PageDriver.evaluate

Evaluate a JavaScript expression and return the result.

evaluate(expression: str) -> Any

Parameter Type Default Description
expression str

Returns: Any

Architecture

Clients

Bots & Agents

Memory

Knowledge

Tools & Toolkits

Flows

Experts

Skills

Stores & Loaders

MCP & A2A

Server & APIs

Integrations

Outputs & A2UI

Prompts

Security

Operations

Migration

SDD Tooling

LLM Wiki

Deployment

Decisions

API Reference

Clone this wiki locally