Koha_Master #1697 koha_1 | /usr/local/share/perl/5.28.1/Selenium/Remote/Driver.pm:1340 in (eval) koha_1 | /kohadevbox/koha/t/lib/Selenium.pm:165 in Selenium::Remote::Driver::find_element koha_1 | t/db_dependent/selenium/administration_tasks.t:188 in t::lib::Selenium::click koha_1 | selenium_1 | 1624989981543 Marionette INFO Stopped listening on port 43585 selenium_1 | 18:06:22.136 INFO [ActiveSessions$1.onStop] - Removing session ee327494-5e3c-4809-aa8c-51d0c0df60b2 (org.openqa.selenium.firefox.GeckoDriverService) koha_1 | Error while executing command: no such element: Unable to locate element: //div[@id="container-main"]//a[contains(@href, "/admin/admin-home.pl")] at /usr/local/share/perl/5.28.1/Selenium/Remote/Driver.pm line 411.
I can reproduce. I'm trying stuff like adding finds before so it waits for an element to be here before continuing. But haven't found yet something that actually works when retrying a lot of times.
For some reason, sometimes $driver->get($mainpage); doesn't do anything and we can wait as much as we want and we won't be on the mainpage
outrageous fix: $driver->get($mainpage); $driver->get($mainpage); It should still eventually fail but the probability will be: once in "a few dozen times" x "a few dozen times" So much lower :D
Created attachment 122624 [details] [review] Bug 28647: Selenium lib: make error handler fail gracefully Quitting the driver makes all the next use of Selenium in the file fail. And go to te error handler where it fails again and goes to the error handler. Now it just fails the current test and continues. I don't know how this wasn't an issue in the previous work on the test suite.
Created attachment 122625 [details] [review] Bug 28647: Wait for elements to load + do twice an unreliable operation Confirmed by 1000 passing runs. After testing: removing any of the 3 fixes almost surely causes a fail in less than 200 runs.
How to recreate the failure?
Running prove t/db_dependent/selenium/administration_tasks.t in a loop without the patches. And hope that on your machine there isn't a too low probability of failure.
Sadly this no longer applies to current master.