Skip to main content

Python SDK for Axon browser automation

Project description

Axon Python SDK

A Python client library for Axon browser automation.

Installation

pip install axon-browser

Quick Start

import asyncio
from axon import Axon

async def main():
    async with Axon("http://localhost:8020/api/v1") as axon:
        # Create a session
        session = await axon.create_session("mysession")
        print(f"Created session: {session.session_id}")
        
        # Navigate to a URL
        await axon.navigate("mysession", "https://github.com")
        
        # Get snapshot
        snapshot = await axon.snapshot("mysession")
        print(f"Page title: {snapshot.title}")
        
        # Click an element
        result = await axon.click("mysession", "e1")
        print(f"Action result: {result.success}")

asyncio.run(main())

Configuration

The Axon client can be configured via:

  1. Constructor parameter:

    axon = Axon("http://localhost:8020/api/v1")
    
  2. Environment variable:

    export AXON_API_URL=http://localhost:8020/api/v1
    
    axon = Axon()  # Uses AXON_API_URL env var
    

API Reference

Session Management

# Create a session
session = await axon.create_session("mysession")

# Get session info
info = await axon.get_session("mysession")

# List all sessions
sessions = await axon.list_sessions()

# Delete a session
await axon.delete_session("mysession")

Navigation

# Navigate to a URL
await axon.navigate("mysession", "https://github.com")

Snapshots

# Get page snapshot
snapshot = await axon.snapshot("mysession")

# Print page elements
for element in snapshot.elements:
    print(f"{element.role}: {element.name}")

Actions

# Click
await axon.click("mysession", "e1")

# Fill input
await axon.fill("mysession", "e2", "Hello World")

# Hover
await axon.hover("mysession", "e3")

# Select option
await axon.select("mysession", "e4", "option1")

# Generic action
await axon.act("mysession", "click", "e1")

Find and Act

# Find element by semantic description and perform action
result = await axon.find_and_act(
    "mysession", 
    "click", 
    "search button"
)

Development

# Clone the repository
git clone https://github.com/rennissance-jomt/axon
cd axon/python

# Install in development mode
pip install -e .

# Install dev dependencies
pip install -e ".[dev]"

# Run tests
pytest

# Lint
ruff check .

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

axon_browser-1.0.1.tar.gz (5.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

axon_browser-1.0.1-py3-none-any.whl (5.7 kB view details)

Uploaded Python 3

File details

Details for the file axon_browser-1.0.1.tar.gz.

File metadata

  • Download URL: axon_browser-1.0.1.tar.gz
  • Upload date:
  • Size: 5.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for axon_browser-1.0.1.tar.gz
Algorithm Hash digest
SHA256 7d4e16d4bab0fc12ff77f208866fca10c4a176e78f7413d79d75b48db04efe09
MD5 8b15cae65ac86086082e07be9243b19c
BLAKE2b-256 8aed25cf548bf42b32b015c981c72bcf9719812da8bb64adec7fca463f2d15dc

See more details on using hashes here.

Provenance

The following attestation bundles were made for axon_browser-1.0.1.tar.gz:

Publisher: publish-python.yml on rennaisance-jomt/Axon

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file axon_browser-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: axon_browser-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 5.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for axon_browser-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 a7f438b8c9b8293ce9b8f06e74afdd0b948152758e24fa73cee1771723dc37e5
MD5 75d1da165c13e21c20b05149f8851260
BLAKE2b-256 c7ce6a3daaa33f8123586fe2cc914454ad11497a4e586ffdf5715a71f264e5ef

See more details on using hashes here.

Provenance

The following attestation bundles were made for axon_browser-1.0.1-py3-none-any.whl:

Publisher: publish-python.yml on rennaisance-jomt/Axon

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page