Skip to main content

Advanced multi-browser automation library

Project description

Browseek: Advanced Multi-Browser Automation Library

Browseek is a sophisticated Python library designed for advanced multi-task and multi-browser automation. It provides a robust solution for managing complex web automation scenarios, including request redirection, DNS security, CAPTCHA handling, device simulation, and fine-grained network control.

Table of Contents

Installation

pip install browseek

Quick Start

from browseek import BrowserRouter

# Initialize the router
router = BrowserRouter()

# Add browser instances
router.add_browser("chrome", count=2)
router.add_browser("firefox", count=1)

# Use the router to perform a task
result = router.execute("https://example.com", lambda page: page.title())
print(result)

# Clean up
router.close()

Getting Started with Docker

To start the Browseek library using Docker, please refer to the DOCKER.md file for detailed instructions.

Core Concepts

  • BrowserRouter: The main class for managing browser instances and routing requests.
  • BrowserInstance: Represents a single headless browser instance.
  • Route: Defines rules for how specific requests should be handled.
  • Task: A unit of work to be executed in a browser instance.

API Reference

BrowserRouter

class BrowserRouter:
    def __init__(self, config: Dict[str, Any] = None):
        """Initialize the BrowserRouter with optional configuration."""

    def add_browser(self, browser_type: str, count: int = 1, options: Dict[str, Any] = None):
        """Add browser instances to the router."""

    def remove_browser(self, browser_id: str):
        """Remove a browser instance from the router."""

    def add_route(self, pattern: str, handler: Callable):
        """Add a route for specific URL patterns."""

    def execute(self, url: str, task: Callable, timeout: int = 30):
        """Execute a task on a suitable browser instance."""

    def close(self):
        """Close all browser instances and clean up resources."""

BrowserInstance

class BrowserInstance:
    def __init__(self, browser_type: str, options: Dict[str, Any] = None):
        """Initialize a browser instance."""

    def navigate(self, url: str):
        """Navigate to a specific URL."""

    def execute_script(self, script: str):
        """Execute JavaScript in the browser context."""

    def take_screenshot(self) -> bytes:
        """Capture a screenshot of the current page."""

Configuration

Browseek can be configured via a Python dictionary or a YAML file:

config = {
    "max_concurrent_browsers": 5,
    "default_timeout": 30,
    "retry_attempts": 3,
    "proxy": {
        "enabled": True,
        "rotate_on_failure": True
    }
}

router = BrowserRouter(config)

Examples

For detailed examples of how to use Browseek for various scenarios, please refer to the EXAMPLES.md file.

Contributing

We welcome contributions to Browseek! Please see our Contributing Guide for more information on how to get started.

Testing

Browseek uses the unittest framework for testing. For information on running tests and writing new tests, please refer to the TESTING.md file.

Changelog

For a detailed list of changes and version history, please see the CHANGELOG.md file.

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

browseek-0.1.7.tar.gz (12.7 kB view details)

Uploaded Source

Built Distribution

browseek-0.1.7-py3-none-any.whl (11.6 kB view details)

Uploaded Python 3

File details

Details for the file browseek-0.1.7.tar.gz.

File metadata

  • Download URL: browseek-0.1.7.tar.gz
  • Upload date:
  • Size: 12.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.3

File hashes

Hashes for browseek-0.1.7.tar.gz
Algorithm Hash digest
SHA256 892915d60cee4403003664d9146e112483619e3c413710d7619b5a2b8a6f490a
MD5 a00201160ceebf6005f3ba050e2a1dcd
BLAKE2b-256 d658e3f9c39c27b8f7b04aab6a7febf7605299a02f007e84aaec49a7b50307a9

See more details on using hashes here.

File details

Details for the file browseek-0.1.7-py3-none-any.whl.

File metadata

  • Download URL: browseek-0.1.7-py3-none-any.whl
  • Upload date:
  • Size: 11.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.3

File hashes

Hashes for browseek-0.1.7-py3-none-any.whl
Algorithm Hash digest
SHA256 cb4ea027756493a211c4c571137749b276d002e2ca879c7630854ea3d924ebc5
MD5 855990e4bfd12c1c47c1c4115e217af9
BLAKE2b-256 0b5902a836fad81fe511086efed912811cf5b6f0e8b3979f7218bde15dda5a3f

See more details on using hashes here.

Supported by

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