Repository navigation
fix(page): drop cached node ids after DOM.getDocument - #656
Merged
Merged
Conversation
DOM.getDocument resets every node id on the target without firing DOM.documentUpdated, so nodes found before frame.content= on an iframe, a whole-page accessibility.query or the document request on frameStoppedLoading kept a dead id and raised NodeNotFoundError. Bump document_version after it so their ids are requested again. Refs #650
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
DOM.getDocumentresets every node id on the target, across all frames, without firingDOM.documentUpdated, so the document version from #653 didn't change and nodes kept a dead id. Every laterfocus,click,scroll_into_viewand so on raisedNodeNotFoundErroron a node that was still on the page. Ferrum sendsgetDocumentfrom:frame.content=. Only the iframe case matters, because on the main framedocument.openremoves the old nodes anyway.accessibility.querywithout a node.page.document_node_id.frameStoppedLoading, so a node found while the page was still loading broke once loading finished.document_node_idnow bumpsdocument_versionafter it sends the command, and nodes request their id again. Bumping before the send could let a racingrequestNodesave an id that thegetDocumentright behind it invalidates.When
DOM.requestNodereturns0(a new document committed, but Ferrum hasn't requested it yet, i.e. a navigation nobody waited for), the error now says the page is still loading a new document instead of only "node is not trackable". It doesn't retry: agetDocumentthere would hide the race and invalidate everyone else's ids, and Capybara'ssynchronizealready retriesObsoleteNodeuntil the page finishes loading.Refs #650