Closed Chekote closed 3 years ago
Seems like your Travis CI is broken? It didn't run on the PR.
@aik099 sorry to bug you, but I wanted to make sure you saw this PR since your CI seems to be broken.
Nice bug report by the way. Very detailed. Thank you @Chekote .
Merging, thanks @Chekote .
Problem
Some websites using a SPA approach have implemented behavior where when a correct value is entered into an input, it is immediately recognized and the SPA updates instantly, causing the input to be detached from the DOM.
e.g. a 2FA input field that immediately recognizes the correct value as it is typed, and causes the SPA to update the page instantly if it is correct.
When this happens, the input is set correctly via the
$element->postValue()
call fromsetValue()
, but when it then proceeds to call$this->executeJsOnElement()
, a StaleElementException is thrown because the input is no longer attached to the DOM.Fix
Catch and swallow the exception.
Rationale
It is not possible to execute JS on an element that is detached from the DOM, so it is impossible to attempt to unfocus it at this point (at least by executing JS on it).
The goal is to unfocus the element, which if it is detached from the DOM, it is clearly unfocused at this point.