From 2c3967b1157f29eec50e49afe3289759ecf1c44c Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Tue, 10 Nov 2020 11:37:55 +0100 Subject: [PATCH] Bug 26986: Prevent Selenium's StaleElementReferenceException Test plan: 1. Add some branch emails via /cgi-bin/koha/admin/branches.pl 2. Go to the OPAC and opac-library.pl, notice there emails are not listed 3. Apply patch 4. Reloda opac-library.pl and you should see the branch email addresses. 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 Signed-off-by: Martin Renvoize Signed-off-by: Jonathan Druart https://bugs.koha-community.org/show_bug.cgi?id=27051 --- koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-library.tt | 3 +++ t/lib/Selenium.pm | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-library.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-library.tt index bd9a7744aa..40198ba1ab 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-library.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-library.tt @@ -56,6 +56,9 @@ [% IF ( library.branchfax ) %]

Fax: [% library.branchfax | html %]

[% END %] + [% IF ( library.branchemail ) %] +

Email: [% library.branchemail | html %]

+ [% END %] [% IF ( library.branchurl ) %]

[% library.branchurl | html %]

[% END %] diff --git a/t/lib/Selenium.pm b/t/lib/Selenium.pm index 758470b668..261502aae1 100644 --- a/t/lib/Selenium.pm +++ b/t/lib/Selenium.pm @@ -218,7 +218,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; } -- 2.11.0