Skip to content

Commit a608c6b

Browse files
committed
Fix edge case regarding jQuery and restrictive CSPs
1 parent 42ad7e7 commit a608c6b

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

seleniumbase/fixtures/base_case.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5969,7 +5969,13 @@ def __jquery_slow_scroll_to(self, selector, by=By.CSS_SELECTOR):
59695969
"""jQuery([document.documentElement, document.body]).animate({
59705970
scrollTop: jQuery('%s').offset().top - 130}, %s);
59715971
""" % (selector, scroll_time_ms))
5972-
self.safe_execute_script(scroll_script)
5972+
if js_utils.is_jquery_activated(self.driver):
5973+
self.execute_script(scroll_script)
5974+
else:
5975+
try:
5976+
self.safe_execute_script(scroll_script)
5977+
except Exception:
5978+
self.__slow_scroll_to_element(element)
59735979
self.sleep(sleep_time)
59745980

59755981
def __jquery_click(self, selector, by=By.CSS_SELECTOR):

0 commit comments

Comments
 (0)