Browser (BrowserSession)
Main browser session manager.Key Methods
Constructor Parameters
See Browser Parameters for complete configuration options.Page
Browser tab/iframe for page-level operations.Navigation
goto(url: str)
- Navigate to URLgo_back()
,go_forward()
,reload()
- History navigation
Element Finding
get_elements_by_css_selector(selector: str) -> list[Element]
- CSS selectorget_element(backend_node_id: int) -> Element
- By CDP node IDget_element_by_prompt(prompt: str, llm) -> Element | None
- AI-poweredmust_get_element_by_prompt(prompt: str, llm) -> Element
- AI (raises if not found)
JavaScript & Controls
evaluate(page_function: str, *args) -> str
- Execute JS (arrow function format)press(key: str)
- Send keyboard input (“Enter”, “Control+A”)set_viewport_size(width: int, height: int)
- Set viewportscreenshot(format='jpeg', quality=None) -> str
- Take screenshot
Information
get_url() -> str
,get_title() -> str
- Page infomouse -> Mouse
- Get mouse interface
AI Features
extract_content(prompt: str, structured_output: type[T], llm) -> T
- Extract data
Element
Individual DOM element interactions.Interactions
click(button='left', click_count=1, modifiers=None)
- Click elementfill(text: str, clear_existing=True)
- Fill inputhover()
,focus()
- Mouse/focus actionscheck()
- Toggle checkbox/radioselect_option(values: str | list[str])
- Select dropdown optionsdrag_to(target: Element | Position)
- Drag and drop
Properties
get_attribute(name: str) -> str | None
- Get attributeget_bounding_box() -> BoundingBox | None
- Position/sizeget_basic_info() -> ElementInfo
- Complete element infoscreenshot(format='jpeg') -> str
- Element screenshot
Mouse
Coordinate-based mouse operations.Operations
click(x: int, y: int, button='left', click_count=1)
- Click at coordinatesmove(x: int, y: int, steps=1)
- Move mousedown(button='left')
,up(button='left')
- Press/release buttonsscroll(x=0, y=0, delta_x=None, delta_y=None)
- Scroll at coordinates