Skip to content

Add browsingContext.getHistory to inspect session history entries #1091

@whimboo

Description

@whimboo

WebDriver BiDi currently supports history traversal (browsingContext.traverseHistory) but provides no way to inspect the session history list (entries + current index). This makes it difficult for clients to implement reliable navigation workflows and debugging features (parity with CDP’s Page.getNavigationHistory) and to handle BFCache restores where load/DOMContentLoaded are not emitted.

In CDP, Page.getNavigationHistory returns the entries and currentIndex, and clients can navigate to a specific entry via Page.navigateToHistoryEntry. BiDi does not currently offer an equivalent.

We should introduce a command like browsingContext.getHistory to retrieve a sanitized view of the browsing context’s session history, which would return all history entries and the current index like:

{
  "context": "context-id",
  "currentIndex": 3,
  "entries": [
    {
      "index": 0,
      "url": "https://example.test/",
      "title": "Home",
      "sameDocument": false
    },
    {
      "index": 1,
      "url": "https://example.test/#a",
      "title": "Home",
      "sameDocument": true
    }
  ]
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions