MCPcopy Index your code
hub / github.com/seleniumbase/SeleniumBase / scroll_to

Method scroll_to

seleniumbase/fixtures/base_case.py:6874–6898  ·  view source on GitHub ↗

Fast scroll to destination

(self, selector, by="css selector", timeout=None)

Source from the content-addressed store, hash-verified

6872 time.sleep(0.1)
6873
6874 def scroll_to(self, selector, by="css selector", timeout=None):
6875 """Fast scroll to destination"""
6876 self.__check_scope()
6877 if not timeout:
6878 timeout = settings.SMALL_TIMEOUT
6879 if self.timeout_multiplier and timeout == settings.SMALL_TIMEOUT:
6880 timeout = self.__get_new_timeout(timeout)
6881 if self.__is_cdp_swap_needed():
6882 self.cdp.scroll_into_view(selector)
6883 return
6884 if self.demo_mode or self.slow_mode:
6885 self.slow_scroll_to(selector, by=by, timeout=timeout)
6886 return
6887 element = self.wait_for_element_visible(
6888 selector, by=by, timeout=timeout
6889 )
6890 try:
6891 self.__scroll_to_element(element, selector, by)
6892 except (Stale_Exception, ENI_Exception):
6893 self.wait_for_ready_state_complete()
6894 time.sleep(0.12)
6895 element = self.wait_for_element_visible(
6896 selector, by=by, timeout=timeout
6897 )
6898 self.__scroll_to_element(element, selector, by)
6899
6900 def scroll_to_element(self, selector, by="css selector", timeout=None):
6901 """Same as self.scroll_to()"""

Callers 15

clearMethod · 0.95
focusMethod · 0.95
set_attributeMethod · 0.95
remove_attributeMethod · 0.95
hoverMethod · 0.95
hover_and_clickMethod · 0.95
drag_and_dropMethod · 0.95
switch_to_frameMethod · 0.95
scroll_to_elementMethod · 0.95
set_valueMethod · 0.95
set_text_contentMethod · 0.95

Calls 9

__check_scopeMethod · 0.95
__get_new_timeoutMethod · 0.95
__is_cdp_swap_neededMethod · 0.95
slow_scroll_toMethod · 0.95
__scroll_to_elementMethod · 0.95
scroll_into_viewMethod · 0.45
sleepMethod · 0.45

Tested by 2

test_presentationMethod · 0.64
test_paginationMethod · 0.64