Skip to content

Pin the selenium BiDi surface with a guarded test #281

Closed

Description

@vishnuv688

Part of #277

The adapter reaches past the public API into driver.network.conn,
bidi.network.NetworkEvent and bidi.session.Session. tests/test_bidi.py runs
entirely on fakes, so a selenium upgrade that moves any of them passes CI green
and degrades at runtime. Selenium PR 17761 regenerates that layer from a shared
schema, which makes the move likely rather than hypothetical.

Acceptance criteria

A test, skipped when selenium is absent, asserts those
three imports and attributes resolve on the installed selenium. It runs in
python.yml and fails loudly on a selenium bump that moves them.

Size: S.

Activity

  1. self-assigned this
    on Aug 12, 2026
  2. vishnuv688 commented on Aug 18, 2026

    @vishnuv688
    MemberAuthor

    Partly addressed, and the CI half is provably unmet

    #317 added one guarded test of this shape — test_pin_registers_without_a_browsing_context — because the preload depends on driver.script.pin() registering globally. pin()'s docstring says "Pins a script to the current browsing context", but it forwards no contexts argument and BiDi reads that as every context. That reliance is undocumented, so a test asserts it: if selenium ever scopes pin to one context, the test fails rather than the preload silently covering only the first document.

    That does not close this issue, on either axis:

    1. The named internals are still unpinned. This issue is about driver.network.conn, bidi.network.NetworkEvent and bidi.session.Session. None of those has a guard; tests/test_bidi.py still runs entirely on fakes.

    2. The acceptance criterion "it runs in python.yml" cannot currently be met. The job installs nothing and runs PYTHONPATH=src python -m unittest discover -s tests, so selenium is absent and any test of the real surface must skip — which is exactly what the new one does:

    Ran 230 tests in 3.812s
    OK (skipped=1)
    

    So the guard exists but never runs where it is supposed to protect. A selenium bump that moves these attributes still passes CI green, which is the failure this issue was filed to prevent.

    The fix is therefore partly a CI change, not only a test: the Python job needs the adapter's own runtime dependency installed (pip install -e . or equivalent) before a guard of this kind is worth anything. That also makes the existing pin() guard live, and would let several other tests exercise real selenium rather than fakes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

selenium-devtools-pyPython Selenium adapter for the DevTools dashboard

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions