Page
Abstract base class for browser page management.
Properties
url
Get current page URL.
Methods
navigate()
Navigate to a URL.
select()
Select all elements matching the selector.
Parameters:
- selector - CSS selector or XPath string
Returns: List of Elements (may be empty)
select_one()
Select a single element matching the selector.
Parameters:
- selector - CSS selector or XPath string
Raises: ValueError if no elements match or multiple elements match
wait_for_load()
Wait for page to fully load.
Parameters:
- timeout - Maximum time to wait in seconds (default: 10.0)
screenshot()
Take a screenshot of the current page.
Parameters:
- path - Optional file path to save screenshot
- full_page - Screenshot the full scrollable page (default: False)
Returns: Screenshot as bytes (PNG format)
keyboard_type()
Type text using keyboard into the currently focused element.
Parameters:
- text - Text to type
- clear - Clear existing text before typing (default: False)
- delay - Delay between keystrokes in seconds (default: 0.05)
evaluate()
Execute JavaScript in the page context.
Parameters:
- script - JavaScript code to execute
Returns: Result of the script execution (JSON-serializable values)
get_cdp_dom_snapshot()
Get a CDP DOM snapshot of the current page.
Returns: CDP DOM snapshot data
get_cdp_accessibility_tree()
Get a CDP accessibility tree of the current page.
Returns: CDP accessibility tree data
close()
Close the page.