diff mbox series

[1/3] toaster/tests/selenium_helper_base: Handle WebDriverException

Message ID 20241011145148.800080-1-richard.purdie@linuxfoundation.org
State New
Headers show
Series [1/3] toaster/tests/selenium_helper_base: Handle WebDriverException | expand

Commit Message

Richard Purdie Oct. 11, 2024, 2:51 p.m. UTC
The WebDriverException can occur if elements are not present in the DOM
yet. Catch and handle this. It is our most frequently occuring failure
in automated testing now.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
---
 lib/toaster/tests/browser/selenium_helpers_base.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/lib/toaster/tests/browser/selenium_helpers_base.py b/lib/toaster/tests/browser/selenium_helpers_base.py
index 393be75496..22d4085b24 100644
--- a/lib/toaster/tests/browser/selenium_helpers_base.py
+++ b/lib/toaster/tests/browser/selenium_helpers_base.py
@@ -27,7 +27,7 @@  from selenium.webdriver.common.by import By
 from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
 from selenium.common.exceptions import NoSuchElementException, \
         StaleElementReferenceException, TimeoutException, \
-        SessionNotCreatedException
+        SessionNotCreatedException, WebDriverException
 
 def create_selenium_driver(cls,browser='chrome'):
     # set default browser string based on env (if available)
@@ -114,6 +114,9 @@  class Wait(WebDriverWait):
                 pass
             except StaleElementReferenceException:
                 pass
+            except WebDriverException:
+                # selenium.common.exceptions.WebDriverException: Message: unknown error: unhandled inspector error: {"code":-32000,"message":"Node with given id does not belong to the document"}
+                pass
 
             time.sleep(self._poll)
             if time.time() > end_time: