Skip to content

Commit c7cb455

Browse files
committed
Refactor imports
1 parent d53ced5 commit c7cb455

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

seleniumbase/fixtures/base_case.py

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,13 @@ def test_anything(self):
3131
import time
3232
import urllib3
3333
import unittest
34-
from selenium.common.exceptions import (StaleElementReferenceException,
35-
MoveTargetOutOfBoundsException,
36-
WebDriverException)
37-
from selenium.common import exceptions as selenium_exceptions
34+
from selenium.common.exceptions import (
35+
ElementClickInterceptedException as ECI_Exception,
36+
ElementNotInteractableException as ENI_Exception,
37+
MoveTargetOutOfBoundsException,
38+
StaleElementReferenceException,
39+
WebDriverException,
40+
)
3841
from selenium.webdriver.common.by import By
3942
from selenium.webdriver.common.keys import Keys
4043
from selenium.webdriver.remote.remote_connection import LOGGER
@@ -53,10 +56,6 @@ def test_anything(self):
5356
logging.getLogger("urllib3").setLevel(logging.ERROR)
5457
urllib3.disable_warnings()
5558
LOGGER.setLevel(logging.WARNING)
56-
SSMD = constants.Values.SSMD # Smooth Scrolling
57-
JS_Exc = selenium_exceptions.JavascriptException
58-
ECI_Exception = selenium_exceptions.ElementClickInterceptedException
59-
ENI_Exception = selenium_exceptions.ElementNotInteractableException
6059

6160

6261
class BaseCase(unittest.TestCase):
@@ -2551,7 +2550,7 @@ def highlight(self, selector, by=By.CSS_SELECTOR,
25512550
if self.browser != "safari":
25522551
scroll_distance = js_utils.get_scroll_distance_to_element(
25532552
self.driver, element)
2554-
if abs(scroll_distance) > SSMD:
2553+
if abs(scroll_distance) > constants.Values.SSMD:
25552554
self.__jquery_slow_scroll_to(selector, by)
25562555
else:
25572556
self.__slow_scroll_to_element(element)
@@ -2735,7 +2734,7 @@ def slow_scroll_to(self, selector, by=By.CSS_SELECTOR, timeout=None):
27352734
try:
27362735
scroll_distance = js_utils.get_scroll_distance_to_element(
27372736
self.driver, element)
2738-
if abs(scroll_distance) > SSMD:
2737+
if abs(scroll_distance) > constants.Values.SSMD:
27392738
self.__jquery_slow_scroll_to(selector, by)
27402739
else:
27412740
self.__slow_scroll_to_element(element)
@@ -7258,8 +7257,9 @@ def __jquery_slow_scroll_to(self, selector, by=By.CSS_SELECTOR):
72587257
dist = js_utils.get_scroll_distance_to_element(self.driver, element)
72597258
time_offset = 0
72607259
try:
7261-
if dist and abs(dist) > SSMD:
7262-
time_offset = int(float(abs(dist) - SSMD) / 12.5)
7260+
if dist and abs(dist) > constants.Values.SSMD:
7261+
time_offset = int(
7262+
float(abs(dist) - constants.Values.SSMD) / 12.5)
72637263
if time_offset > 950:
72647264
time_offset = 950
72657265
except Exception:
@@ -7487,7 +7487,7 @@ def __demo_mode_highlight_if_active(self, selector, by):
74877487
try:
74887488
scroll_distance = js_utils.get_scroll_distance_to_element(
74897489
self.driver, element)
7490-
if abs(scroll_distance) > SSMD:
7490+
if abs(scroll_distance) > constants.Values.SSMD:
74917491
self.__jquery_slow_scroll_to(selector, by)
74927492
else:
74937493
self.__slow_scroll_to_element(element)
@@ -7522,7 +7522,7 @@ def __highlight_with_assert_success(
75227522
try:
75237523
scroll_distance = js_utils.get_scroll_distance_to_element(
75247524
self.driver, element)
7525-
if abs(scroll_distance) > SSMD:
7525+
if abs(scroll_distance) > constants.Values.SSMD:
75267526
self.__jquery_slow_scroll_to(selector, by)
75277527
else:
75287528
self.__slow_scroll_to_element(element)

0 commit comments

Comments
 (0)