@@ -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:
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(-)