#2733·stagehand

Python SDK browser tests use POSIX-only path assertions on Windows

Author: abhinavkr26104Created Aug 15, 2026Updated Aug 15, 2026

Description

Two Python SDK browser tests make POSIX-only string assertions and fail on Windows even though the browser code returns valid native paths.

One assertion expects Path("/tmp/downloads") to stringify with forward slashes. Another checks an extension directory using forward-slash suffixes. On Windows, Python correctly produces backslash-separated paths, so the focused browser test module cannot pass.

Code reference

  • packages/sdk-python/tests/test_browser.py:339-356 passes Path("/tmp/downloads") and asserts the captured string is exactly "/tmp/downloads".
  • packages/sdk-python/tests/test_browser.py:437-448 asserts that the extension directory ends with either "stagehand/_extension" or "extension/dist".
  • packages/sdk-python/src/stagehand/browser.py:411 intentionally converts the caller's Path with str().
  • packages/sdk-python/src/stagehand/browser.py:438 similarly forwards the packaged extension path as a native string.

Reproduction

On Windows 11 with Python 3.11+:

powershell
uv run --project packages/sdk-python pytest packages/sdk-python/tests/test_browser.py

The module reports two failures:

  1. test_launch_configures_downloads_on_the_root_session
    • expected: /tmp/downloads
    • actual: \tmp\downloads
  2. test_connect_uses_extension_id_or_packaged_extension_and_never_owns_source
    • the native path ends in stagehand\_extension or extension\dist, so neither forward-slash suffix matches.

The rest of the Python suite completes with 455 passed and 2 skipped in the same environment; these two assertions are the deterministic failures.

Expected behavior

The tests should compare paths semantically (for example with Path components or normalized separators) and pass on supported desktop platforms.

Actual behavior

Valid native Windows paths fail hard-coded POSIX string comparisons, making the Python SDK test suite red for Windows contributors.

Why it matters

The repository contains active Windows-specific fixes and local-browser support. Deterministic platform-only failures hide real regressions and prevent contributors from using the documented test gate reliably.

Duplicate/history check

I searched open and closed issues and PRs for the two test names, downloads_path on Windows, extension-directory path assertions, and Python path separators. Existing Windows work covers other launcher, CLI, and cleanup problems; I found no report or fix for these two v4 Python assertions.