Repository navigation
fix(node): ignore a lost execution context when refocusing a field after typing - #382
Merged
Merged
Conversation
…ter typing Typing a value that ends in \n can submit the form, and the page may navigate away before set refocuses the field. The refocus then raised Ferrum::NoExecutionContextError, which Capybara retries on, so it set the obsolete node again and raised ObsoleteNode. It's rescued like Ferrum::NodeNotFoundError already was.
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.
Capybara's
#set should submit single text input forms if ended with \nspec failed on CI in #381 (job) withObsoleteNode. That PR doesn't touch this code. The bug came in with the real key presses from #377.When a value ends in
\n, Enter submits the form. After typing,setrefocuses the field (blur(); focus()). If the page has already started navigating, Chrome has dropped the field's JS context and raisesFerrum::NoExecutionContextError. Capybara treats that error as retryable, so it ransetagain on a node that no longer exists and raisedObsoleteNode.Typing#refocusrescuesFerrum::NoExecutionContextErrorthe same way it already rescuedFerrum::NodeNotFoundError.setcalls hit the error 9 times before the fix and 0 times after.Node#setspec stubs the refocus to raise the error Chrome sends. It calls the driver node directly, because otherwise Capybara would reload the element and retry, which hides the error. It fails without the fix and passes with it.