Skip to content

Recover DOM capture on documents that missed injection #286

Description

@vishnuv688

Part of #277

core's drainCollectorWithRecovery re-injects into the current
document when a drain finds no collector, then retries. Python has no equivalent,
so a document that missed injection contributes nothing and the actions on it
replay the previous page.

Acceptance criteria

A drain that finds no collector re-injects and retries
once, logging the recovery. Unit tested against a fake execute_script that
reports a missing collector and then a present one.

Size: M. Depends on #284.

Activity

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

    @vishnuv688
    MemberAuthor

    Done in 70a6223 (#317), which arrived via a review comment on the preload PR rather than by picking this up — recording it here so nobody rebuilds it.

    Both acceptance criteria are met:

    • "A drain that finds no collector re-injects and retries once" — pull_mutations now distinguishes the two failure modes the old code flattened together. _READ_TRACE_SCRIPT answers null when the collector is absent from this document, which is the only signal that says so; a read that actually failed returns a separate _UNREADABLE sentinel and does not trigger recovery, because a dead session should not be re-injected into. On null it installs via the <script> path and reads once more. Mirrors core's drainCollectorWithRecovery, including recovering at drain time rather than at inject time — which costs nothing on the happy path, since the drain happens either way.
    • "Unit tested against a fake execute_script that reports a missing collector and then a present one" — test_the_drain_recovers_a_document_without_a_collector drives exactly that fake, plus test_a_healthy_preloaded_document_is_not_reinstalled asserting a document that answers triggers no <script> at all.

    Worth noting the gap this closed was wider than the issue described: the <script> path never had drain-time recovery either, so this was not only a preload concern.

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

Metadata

Metadata

Assignees

Labels

enhancementNew feature or requestselenium-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