Automation
AI
Test Automation
Selenium Teleport v2.1.0: Enterprise-Grade Security for Browser State Management

Selenium Teleport v2.1.0: Enterprise-Grade Security for Browser State Management

January 12, 2026 2 min read

*(In continuation of: Selenium Teleport: Skip Login Screens Forever)*

Selenium Teleport is a specialized Python library designed to eliminate the 'Login Tax' in browser automation. It works by capturing the complete browser state—including cookies, localStorage, sessionStorage, and IndexedDB—and 'teleporting' it into fresh browser instances. This allows tests to arrive at their destination already authenticated, skipping slow and flaky login flows entirely.

What's New in v2.1.0

A few months ago, I released Selenium Teleport to solve a simple problem: skip login screens in browser automation. Today, I'm releasing v2.1.0 with the security features that make it production-ready.

🔒

The Security Problem

The original Selenium Teleport worked great. But there was a problem: state files contain sensitive data.

Code
{
  "cookies": [
    {"name": "session_id", "value": "abc123xyz789..."},
    {"name": "auth_token", "value": "eyJhbGciOiJIUzI1NiIs..."}
  ],
  "localStorage": {
    "jwt": "eyJhbGciOiJSUzI1NiIsInR5cCI6..."
  }
}

Session tokens. JWTs. Authentication credentials. All in plain JSON. For local testing, that's fine. For CI/CD pipelines, shared environments, or any enterprise use case, it's a security risk.

🔑

State File Encryption

v2.1.0 introduces Fernet symmetric encryption to ensure your credentials stay private.

Code
import os
from selenium_teleport import create_driver, Teleport

# Generate a key once (save this securely!)
# key = generate_key()

os.environ["TELEPORT_ENCRYPTION_KEY"] = "your-fernet-key-here"

driver = create_driver()

with Teleport(driver, "session.enc", encrypt=True) as t:
    if t.has_state():
        t.load("https://example.com/dashboard")
    else:
        driver.get("https://example.com/login")
        # Login...

The state file is now encrypted at rest. No more plaintext credentials on disk.

🛡️

Security Validation Layers

Beyond encryption, v2.1.0 adds three critical validation layers:

1. Token Expiry Validation

Code
from selenium_teleport import load_state

# Automatically removes expired cookies before injection
load_state(driver, "session.json", "https://example.com", validate_expiry=True)

No more injecting stale tokens that cause silent authentication failures.

2. Domain Validation

Code
# Prevents cross-domain injection attacks
load_state(driver, "evil_state.json", "https://bank.com", validate_domain=True)
# Raises DomainMismatchError if state was saved from a different domain

State from `evil.com` can't be loaded into `bank.com`.

3. Input Sanitization

Enterprise-grade input validation is now built-in, protecting against path traversal and SSRF attempts.

🧩

Modular Architecture

The original `core.py` was a monologue of 816 lines. v2.1.0 breaks it into 10 focused modules for long-term maintainability.

ModulePurpose
`drivers.py`WebDriver creation with anti-detection
`state.py`State save/load with encryption
`security.py`Encryption, validation, sanitization
`config.py`Configuration management
`exceptions.py`13 specific exception types
`cookies.py`Cookie utilities
`storage.py`localStorage/sessionStorage
`stealth.py`sb-stealth-wrapper integration
`context.py`Context managers
`utils.py`URL helpers
⚠️

Exception Hierarchy

No more generic `Exception` catches. v2.1.0 has a proper exception hierarchy for granular error handling.

Code
from selenium_teleport import (
    TeleportError,           # Base
    SecurityError,           # Security violations
    DomainMismatchError,     # Cross-domain attempt
    EncryptionError,         # Encryption/decryption failed
    ExpiredSessionError,     # All cookies expired
    StateFileNotFoundError,  # File doesn't exist
)

try:
    load_state(driver, "session.json", "https://example.com")
except DomainMismatchError:
    print("Security violation: domain mismatch")
except ExpiredSessionError:
    print("Session expired, re-authenticating...")
⚙️

GDPR-Compliant Deletion

For compliance requirements, you can now securely overwrite files before deletion.

Code
from selenium_teleport import delete_state

# Securely overwrite before deletion
delete_state("session.json", secure=True)
📊

48 Unit Tests + CI/CD

Full test coverage across all modules ensures reliability. GitHub Actions CI runs tests across Python 3.8-3.12 with linting and security scanning.

Code
pytest tests/ -v
# 48 passed
🤖

sb-stealth-wrapper v0.4.0 Integration

Updated for the latest sb-stealth-wrapper with `success_criteria` support.

Code
from selenium_teleport import create_driver

with create_driver(use_stealth_wrapper=True, success_criteria="Dashboard") as bot:
    bot.safe_get("https://example.com")
🚀

Get Started

Code
pip install selenium-teleport[security,stealth]
Built by Dhiraj Das
Automation Architect. Because security shouldn't be an afterthought.
Dhiraj Das

About the Author

Dhiraj Das | Senior Automation Consultant | 10+ years building test automation that actually works. He transforms flaky, slow regression suites into reliable CI pipelines—designing self-healing frameworks that don't just run tests, but understand them.

Creator of many open-source tools solving what traditional automation can't: waitless (flaky tests), sb-stealth-wrapper (bot detection), selenium-teleport (state persistence), selenium-chatbot-test (AI chatbot testing), lumos-shadowdom (Shadow DOM), and visual-guard (visual regression).

Share this article:

Get In Touch

Interested in collaborating or have a question about my projects? Feel free to reach out. I'm always open to discussing new ideas and opportunities.