Skip to content

Commit

Permalink
try-exept_on_close_browser (#10514)
Browse files Browse the repository at this point in the history
Signed-off-by: Daniel Osypenko <[email protected]>
  • Loading branch information
DanielOsypenko authored Sep 19, 2024
1 parent d5cbe4e commit 8548ab9
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions ocs_ci/ocs/ui/base_ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
NoSuchElementException,
StaleElementReferenceException,
ElementClickInterceptedException,
InvalidSessionIdException,
)
from selenium.webdriver.remote.webdriver import WebDriver
from selenium.webdriver.chrome.options import Options
Expand Down Expand Up @@ -1029,9 +1030,14 @@ def close_browser():
"""
logger.info("Close browser")
take_screenshot("close_browser")
copy_dom("close_browser")
SeleniumDriver().quit()
try:
take_screenshot("close_browser")
copy_dom("close_browser")
SeleniumDriver().quit()
except InvalidSessionIdException:
# when browser session is closed unexpectedly or session timeout occurs take_screenshot or copy_dom will fail
logger.error("InvalidSessionIdException occurred")
pass
SeleniumDriver.remove_instance()
time.sleep(10)
garbage_collector_webdriver()
Expand Down

0 comments on commit 8548ab9

Please sign in to comment.