Overview

Browser Controls

Complete reference of all browser actions available in sessions

Goto#

Navigate to a URL.

from notte_sdk import NotteClient
 
client = NotteClient()
 
with client.Session() as session:
    session.execute(type="goto", url="https://example.com")

Parameters: url (str) — The URL to navigate to.

GotoNewTab#

Open a URL in a new browser tab.

session.execute(type="goto_new_tab", url="https://example.com/products")

SwitchTab#

Switch to a different browser tab.

session.execute(type="goto", url="https://example.com")
session.execute(type="goto_new_tab", url="https://example.com/products")
session.execute(type="switch_tab", tab_index=0)

GoBack / GoForward / Reload#

session.execute(type="go_back")
session.execute(type="go_forward")
session.execute(type="reload")

Interaction Actions#

Click#

Click on an element.

session.execute(type="goto", url="https://example.com")
 
# Click by CSS selector
session.execute(type="click", selector="button#submit")
 
# Only use IDs that appear in your live observe() output.
session.execute(type="click", id="B1")
 
# Click by text selector
session.execute(type="click", selector="button:has-text('Submit')")

Parameters: selector (str), id (str), text (str), aria_label (str), placeholder (str), title (str)

Fill#

Fill a text input or textarea.

session.execute(type="fill", selector="input[name='email']", value="user@example.com")
 
# Only use IDs that appear in your live observe() output.
session.execute(type="fill", id="I1", value="user@example.com")

Parameters: selector (str), id (str), placeholder (str), aria_label (str), value (str)

Check#

Check or uncheck a checkbox.

session.execute(type="check", selector="input[type='checkbox']#terms", value=True)
session.execute(type="check", selector="input[type='checkbox']#newsletter", value=False)

SelectDropdownOption#

session.execute(type="select_dropdown_option", selector="select#country", value="United States")

PressKey#

session.execute(type="press_key", key="Enter")
session.execute(type="press_key", key="Escape")

Common keys: Enter, Escape, Tab, ArrowUp, ArrowDown, ArrowLeft, ArrowRight, Backspace, Delete

EvaluateJs#

Evaluate JavaScript code on the current page and return the result.

session.execute(type="goto", url="https://notte.cc/")
session.execute(type="evaluate_js", code="document.title")

Scrolling Actions#

session.execute(type="scroll_up")
session.execute(type="scroll_down")

File Actions#

UploadFile#

session.execute(type="upload_file", selector="input[type='file']", file_path="/path/to/document.pdf")

DownloadFile#

result = session.execute(type="download_file", selector="a.download-link")

Wait Action#

session.execute(type="wait", time_ms=2000)

Note: Use sparingly. Notte automatically waits for page loads and element visibility. Only use Wait for specific timing requirements.

Data Extraction#

Scrape#

from pydantic import BaseModel
 
class Product(BaseModel):
    name: str
    price: float
 
with client.Session() as session:
    session.execute(type="goto", url="https://example.com")
 
    # Get page markdown
    markdown = session.scrape()
 
    # Extract with instructions
    data = session.scrape(instructions="Extract all product names and prices")
 
    # Structured extraction
    products = session.scrape(response_format=Product, instructions="Extract all products")

See Scraping for detailed documentation.

Communication Actions#

SmsRead / EmailRead#

Read SMS or email messages from a persona's phone number / email address, useful for reading 2FA codes and verification links. See Personas for details.

Action Patterns#

Chaining Actions#

with client.Session() as session:
    session.execute(type="goto", url="https://example.com/login")
    session.execute(type="fill", selector="input[name='email']", value="user@example.com")
    session.execute(type="fill", selector="input[name='password']", value="password123")
    session.execute(type="click", selector="button[type='submit']")
    session.execute(type="wait", time_ms=2000)
    content = session.scrape()

Error Handling#

result = session.execute(type="click", selector="button.maybe-exists", raise_on_failure=False)
 
if result.success:
    print("Button clicked successfully")
else:
    print(f"Click failed: {result.message}")

Selector Strategies#

Prefer stable selectors:

# Good - uses ID (stable)
session.execute(type="click", id="submit-btn")
 
# Good - uses data attribute
session.execute(type="click", selector="button[data-testid='submit']")
 
# Avoid - fragile position-based
session.execute(type="click", selector="div > div > button:nth-child(3)")

Common Workflows#

Search and Extract#

session.execute(type="goto", url="https://example.com")
session.execute(type="fill", selector="input[name='search']", value="laptop")
session.execute(type="press_key", key="Enter")
session.execute(type="wait", time_ms=2000)
 
results = session.scrape(instructions="Extract search results")

Multi-Tab Workflow#

with client.Session() as session:
    session.execute(type="goto", url="https://site1.com")
    session.execute(type="goto_new_tab", url="https://site2.com")
    session.execute(type="goto_new_tab", url="https://site3.com")
 
    for tab_index in range(3):
        session.execute(type="switch_tab", tab_index=tab_index)
        data = session.scrape()

Next Steps#


Back to overview

Updated

Was this page helpful?