Bug 26986: Prevent Selenium's StaleElementReferenceException

This is a follow-up bug for bug 26162

By finding the element before the click I hope to get the good element,
even if the page changed in the meanwhile.

Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 836d9a3872)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
(cherry picked from commit b0af61fdc7)
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
This commit is contained in:
Jonathan Druart 2020-11-10 11:37:55 +01:00 committed by Victor Grousset/tuxayo
parent 0fdac36bbe
commit b092a77025
1 changed files with 1 additions and 1 deletions

View File

@ -212,7 +212,7 @@ sub click_when_visible {
my $clicked;
$self->remove_error_handler;
while ( not $clicked ) {
eval { $elt->click };
eval { $self->driver->find_element($xpath_selector)->click };
$clicked = !$@;
$self->driver->pause(1000) unless $clicked;
}