From e2d094568bc92a6aab4d55fe25b77639542f4590 Mon Sep 17 00:00:00 2001 From: am-agrawa Date: Tue, 30 Jul 2024 22:22:08 +0530 Subject: [PATCH] fix stale element Signed-off-by: am-agrawa --- ocs_ci/ocs/acm/acm.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/ocs_ci/ocs/acm/acm.py b/ocs_ci/ocs/acm/acm.py index 413e0d2b2b85..8c154f01d598 100644 --- a/ocs_ci/ocs/acm/acm.py +++ b/ocs_ci/ocs/acm/acm.py @@ -7,7 +7,11 @@ from selenium.webdriver.support.wait import WebDriverWait from selenium.webdriver.support import expected_conditions as ec from selenium.webdriver.common.by import By -from selenium.common.exceptions import NoSuchElementException +from selenium.common.exceptions import ( + NoSuchElementException, + StaleElementReferenceException, + TimeoutException, +) from ocs_ci.helpers.helpers import create_unique_resource_name from ocs_ci.ocs import constants from ocs_ci.ocs.acm.acm_constants import ( @@ -43,6 +47,7 @@ from ocs_ci.utility import templating from ocs_ci.ocs.resources.ocs import OCS from ocs_ci.helpers.helpers import create_project +from ocs_ci.utility.retry import retry log = logging.getLogger(__name__) @@ -56,6 +61,7 @@ class AcmAddClusters(AcmPageNavigator): def __init__(self): super().__init__() self.page_nav = self.acm_page_nav + self.driver = SeleniumDriver() def import_cluster_ui(self, cluster_name, kubeconfig_location): """ @@ -234,7 +240,9 @@ def install_submariner_ui(self, globalnet=True): log.info("Click on 'Submariner add-ons' tab") self.do_click(self.page_nav["submariner-tab"]) log.info("Click on 'Install Submariner add-ons' button") - self.do_click(self.page_nav["install-submariner-btn"], timeout=120) + retry((StaleElementReferenceException, TimeoutException), retries=5, delay=10)( + self.do_click + )(self.page_nav["install-submariner-btn"], enable_screenshot=True) log.info("Click on 'Target clusters'") self.do_click(self.page_nav["target-clusters"]) log.info(f"Select 1st cluster which is {cluster_name_a}")