SDKs
Python SDK
pip install mrbrowser gives you the full engine with a Pythonic API — designed to feel native inside pytest.
# Basic usage
quickstart.py
python
from mrbrowser import MrBrowser
with MrBrowser() as browser:
page = browser.open("https://shop.example.com")
page.type("the search field", "mechanical keyboard")
page.click("the search button")
page.click("the first product card")
assert "Add to cart" in page.get_html()# Pytest integration
Share one Memory Engine database across your suite so fingerprints accumulate run over run — that history is what powers self-healing in CI.
test_checkout.py
python
# conftest.py
import pytest
from mrbrowser import MrBrowser
@pytest.fixture
def browser():
with MrBrowser(host="localhost", port=7331) as b:
yield b
# test_checkout.py
def test_checkout_survives_redesign(browser):
page = browser.open("https://shop.example.com")
page.click("Add to cart")
page.click("the checkout button")
assert page.assert_text("Order summary")
price = page.extract_text("the order total")
assert price.startswith("$")Tip
Commit
.mrbrowser/memory.db to your repo (it's a compact SQLite file). Fresh CI runners then start with the full fingerprint history instead of a cold cache.# Semantic extraction
extract.py
python
page = browser.open("https://billing.corp.com/invoices")
# Extract a specific field by plain-English description
balance = page.extract_text("the account balance")
# Inspect all elements on the page (useful for debugging)
elements = page.inspect(visible_only=True)
for el in elements:
print(el["text"], el["role"], el["selector"])
# Cookie management
cookies = page.get_cookies()
page.set_cookies([{"name": "session", "value": "abc123"}])
# Run JS
result = page.execute_js("return document.title")Warning
extract() resolves intents per field, per row. On tables with 1000+ rows, pass batch=True to fingerprint the row structure once — otherwise extraction time grows linearly.