Uses the JS scrollIntoView() method to scroll to an element. Unlike other scroll methods, (which put elements upper-center), this method places elements at the very top of the screen.
(self, selector, by="css selector", timeout=None)
| 6943 | self.slow_scroll_to(selector, by=by, timeout=timeout) |
| 6944 | |
| 6945 | def scroll_into_view(self, selector, by="css selector", timeout=None): |
| 6946 | """Uses the JS scrollIntoView() method to scroll to an element. |
| 6947 | Unlike other scroll methods, (which put elements upper-center), |
| 6948 | this method places elements at the very top of the screen.""" |
| 6949 | self.__check_scope() |
| 6950 | if not timeout: |
| 6951 | timeout = settings.SMALL_TIMEOUT |
| 6952 | if self.timeout_multiplier and timeout == settings.SMALL_TIMEOUT: |
| 6953 | timeout = self.__get_new_timeout(timeout) |
| 6954 | if self.__is_cdp_swap_needed(): |
| 6955 | self.cdp.scroll_into_view(selector) |
| 6956 | return |
| 6957 | element = self.wait_for_element_visible(selector, by, timeout=timeout) |
| 6958 | self.execute_script("arguments[0].scrollIntoView();", element) |
| 6959 | |
| 6960 | def scroll_to_top(self): |
| 6961 | """Scroll to the top of the page.""" |
no test coverage detected