@@ -31,10 +31,13 @@ def test_anything(self):
31
31
import time
32
32
import urllib3
33
33
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
+ )
38
41
from selenium .webdriver .common .by import By
39
42
from selenium .webdriver .common .keys import Keys
40
43
from selenium .webdriver .remote .remote_connection import LOGGER
@@ -53,10 +56,6 @@ def test_anything(self):
53
56
logging .getLogger ("urllib3" ).setLevel (logging .ERROR )
54
57
urllib3 .disable_warnings ()
55
58
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
60
59
61
60
62
61
class BaseCase (unittest .TestCase ):
@@ -2551,7 +2550,7 @@ def highlight(self, selector, by=By.CSS_SELECTOR,
2551
2550
if self .browser != "safari" :
2552
2551
scroll_distance = js_utils .get_scroll_distance_to_element (
2553
2552
self .driver , element )
2554
- if abs (scroll_distance ) > SSMD :
2553
+ if abs (scroll_distance ) > constants . Values . SSMD :
2555
2554
self .__jquery_slow_scroll_to (selector , by )
2556
2555
else :
2557
2556
self .__slow_scroll_to_element (element )
@@ -2735,7 +2734,7 @@ def slow_scroll_to(self, selector, by=By.CSS_SELECTOR, timeout=None):
2735
2734
try :
2736
2735
scroll_distance = js_utils .get_scroll_distance_to_element (
2737
2736
self .driver , element )
2738
- if abs (scroll_distance ) > SSMD :
2737
+ if abs (scroll_distance ) > constants . Values . SSMD :
2739
2738
self .__jquery_slow_scroll_to (selector , by )
2740
2739
else :
2741
2740
self .__slow_scroll_to_element (element )
@@ -7258,8 +7257,9 @@ def __jquery_slow_scroll_to(self, selector, by=By.CSS_SELECTOR):
7258
7257
dist = js_utils .get_scroll_distance_to_element (self .driver , element )
7259
7258
time_offset = 0
7260
7259
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 )
7263
7263
if time_offset > 950 :
7264
7264
time_offset = 950
7265
7265
except Exception :
@@ -7487,7 +7487,7 @@ def __demo_mode_highlight_if_active(self, selector, by):
7487
7487
try :
7488
7488
scroll_distance = js_utils .get_scroll_distance_to_element (
7489
7489
self .driver , element )
7490
- if abs (scroll_distance ) > SSMD :
7490
+ if abs (scroll_distance ) > constants . Values . SSMD :
7491
7491
self .__jquery_slow_scroll_to (selector , by )
7492
7492
else :
7493
7493
self .__slow_scroll_to_element (element )
@@ -7522,7 +7522,7 @@ def __highlight_with_assert_success(
7522
7522
try :
7523
7523
scroll_distance = js_utils .get_scroll_distance_to_element (
7524
7524
self .driver , element )
7525
- if abs (scroll_distance ) > SSMD :
7525
+ if abs (scroll_distance ) > constants . Values . SSMD :
7526
7526
self .__jquery_slow_scroll_to (selector , by )
7527
7527
else :
7528
7528
self .__slow_scroll_to_element (element )
0 commit comments