Skip to content

Commit 44b5809

Browse files
committed
Refactor imports for exception-handling
1 parent 942d2ba commit 44b5809

File tree

4 files changed

+13
-13
lines changed

4 files changed

+13
-13
lines changed

seleniumbase/fixtures/js_utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import re
66
import requests
77
import time
8+
from selenium.common.exceptions import NoSuchElementException
89
from selenium.common.exceptions import WebDriverException
910
from seleniumbase import config as sb_config
1011
from seleniumbase.common import decorators
@@ -214,8 +215,7 @@ def wait_for_css_query_selector(
214215
if now_ms >= stop_ms:
215216
break
216217
time.sleep(0.1)
217-
218-
raise Exception(
218+
raise NoSuchElementException(
219219
"Element {%s} was not present after %s seconds!" % (
220220
selector, timeout))
221221

seleniumbase/fixtures/page_actions.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,15 @@
2323
import os
2424
import sys
2525
import time
26+
from selenium.common.exceptions import ElementNotVisibleException
27+
from selenium.common.exceptions import NoAlertPresentException
28+
from selenium.common.exceptions import NoSuchElementException
29+
from selenium.common.exceptions import NoSuchFrameException
30+
from selenium.common.exceptions import NoSuchWindowException
2631
from selenium.common.exceptions import StaleElementReferenceException
2732
from selenium.common import exceptions as selenium_exceptions
2833
from selenium.webdriver.common.by import By
2934
from selenium.webdriver.common.action_chains import ActionChains
30-
from selenium.webdriver.remote.errorhandler import ElementNotVisibleException
31-
from selenium.webdriver.remote.errorhandler import NoSuchElementException
32-
from selenium.webdriver.remote.errorhandler import NoAlertPresentException
33-
from selenium.webdriver.remote.errorhandler import NoSuchFrameException
34-
from selenium.webdriver.remote.errorhandler import NoSuchWindowException
3535
from seleniumbase.config import settings
3636
from seleniumbase.fixtures import shared_utils as s_utils
3737
ENI_Exception = selenium_exceptions.ElementNotInteractableException

seleniumbase/fixtures/shared_utils.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
This module contains shared utility methods.
33
"""
44
import time
5-
from selenium.webdriver.remote.errorhandler import ElementNotVisibleException
6-
from selenium.webdriver.remote.errorhandler import NoSuchElementException
7-
from selenium.webdriver.remote.errorhandler import NoAlertPresentException
8-
from selenium.webdriver.remote.errorhandler import NoSuchFrameException
9-
from selenium.webdriver.remote.errorhandler import NoSuchWindowException
5+
from selenium.common.exceptions import ElementNotVisibleException
6+
from selenium.common.exceptions import NoAlertPresentException
7+
from selenium.common.exceptions import NoSuchElementException
8+
from selenium.common.exceptions import NoSuchFrameException
9+
from selenium.common.exceptions import NoSuchWindowException
1010
from seleniumbase.common.exceptions import NoSuchFileException
1111
from seleniumbase.common.exceptions import TimeLimitExceededException
1212
from seleniumbase import config as sb_config

seleniumbase/masterqa/master_qa.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
import shutil
33
import sys
44
import time
5+
from selenium.common.exceptions import NoAlertPresentException
56
from selenium.common.exceptions import WebDriverException
6-
from selenium.webdriver.remote.errorhandler import NoAlertPresentException
77
from seleniumbase import BaseCase
88
from seleniumbase.core.style_sheet import style
99
from seleniumbase.config import settings

0 commit comments

Comments
 (0)