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
}
]
}
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’sPage.getNavigationHistory) and to handle BFCache restores whereload/DOMContentLoadedare not emitted.In CDP,
Page.getNavigationHistoryreturns the entries andcurrentIndex, and clients can navigate to a specific entry viaPage.navigateToHistoryEntry. BiDi does not currently offer an equivalent.We should introduce a command like
browsingContext.getHistoryto 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 } ] }