Skip to content

Commit 6bb5847

Browse files
committed
Improve reliability when slow-scrolling to elements
1 parent a3249b0 commit 6bb5847

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

seleniumbase/fixtures/base_case.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6090,7 +6090,11 @@ def __scroll_to_element(self, element, selector=None, by=By.CSS_SELECTOR):
60906090
self.__demo_mode_pause_if_active(tiny=True)
60916091

60926092
def __slow_scroll_to_element(self, element):
6093-
js_utils.slow_scroll_to_element(self.driver, element, self.browser)
6093+
try:
6094+
js_utils.slow_scroll_to_element(self.driver, element, self.browser)
6095+
except Exception:
6096+
# Scroll to the element instantly if the slow scroll fails
6097+
js_utils.scroll_to_element(self.driver, element)
60946098

60956099
def __highlight_with_assert_success(
60966100
self, message, selector, by=By.CSS_SELECTOR):

0 commit comments

Comments
 (0)