I am using selenium tests to perform GUI-based system tests of non-public scientific use cases. Although I have build more-or-less a complete wrapper around the selenium module with functions to always wait for an element to appear (WebDriverWait
), to handle inter-nested iframes (switch-to-frame
), and even to catch exceptions to try things again (like obtaining the WebDriver
in the first place), the tests barely run through fine all the time. I get random failures in different tests all the time, with no obvious cause and not repeatable.
My guess for reasons the tests are failing are:
- selenium is NOT user friendly at all and throws a lot of strange errors without reason
- the pages I load uses many other services that are outside of my control (authentication framework, analysis framework etc)
- the pages load time can be long (10 seconds) and sometimes do not load at all.
Is there maybe a different framework or a kind of wrapper around selenium, which provides methods for SOLID tests that deliver consistent, reliable and reproducible test results? Or are there some other ideas to make selenium tests consistent, reliable and reproducible?
Some of the errors:
- Random
Timeout
errors (I wait enough time for an element to appear, but it does not appear. Reason currently unknown, very hard to debug because when testing manually these errors do not show up) - Random
WebDriverException
: e.g.can't access dead object
(again, does not appear when running the single test case manually or automatically). - Random timeouts on the socket level.
StaleElementReferenceException
- Element not found although visible, present and clickable and visible on screenshot, and working locally but not inside docker...