10 examples of 'scroll down in selenium python' in Python

Every line of 'scroll down in selenium python' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your Python code is secure.

All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
this disclaimer
42def scroll_down(self, wait=0.5):
43 self.driver.execute_script(
44 'window.scrollTo(0, document.body.scrollHeight)')
45 sleep(wait)
Important

Use secure code every time

Secure your code as it's written. Use Snyk Code to scan source code in minutes – no build needed – and fix issues immediately. Enable Snyk Code

30def scroll_to(driver, el):
31 """
32 Scroll an element into view, using JS
33 """
34 try:
35 driver.execute_script("arguments[0].scrollIntoView();", el)
36 except SELENIUM_EXCEPTIONS:
37 return
74def scroll_down(self, wait=0.3):
75 self.driver.execute_script("window.scrollTo(0, document.body.scrollHeight)")
76 randmized_sleep(wait)
484def scroll_to(self, x, y):
485 """
486 Scroll to a particular (x, y) coordinate.
487
488 :param x: the x coordinate to scroll to.
489 :type x: int
490 :param y: the y coordinate to scroll to.
491 :type y: int
492 :return:
493 """
494 # prevent script injection
495 x = int(x)
496 y = int(y)
497 self.execute_script('window.scrollTo({}, {});'.format(x, y))
1284def scroll_to(self, selector, by=By.CSS_SELECTOR,
1285 timeout=settings.SMALL_TIMEOUT):
1286 ''' Fast scroll to destination '''
1287 if self.demo_mode:
1288 self.slow_scroll_to(selector, by=by, timeout=timeout)
1289 return
1290 if self.timeout_multiplier and timeout == settings.SMALL_TIMEOUT:
1291 timeout = self.__get_new_timeout(timeout)
1292 element = self.wait_for_element_visible(
1293 selector, by=by, timeout=timeout)
1294 try:
1295 self.__scroll_to_element(element)
1296 except (StaleElementReferenceException, ENI_Exception):
1297 self.wait_for_ready_state_complete()
1298 time.sleep(0.05)
1299 element = self.wait_for_element_visible(
1300 selector, by=by, timeout=timeout)
1301 self.__scroll_to_element(element)
374def shift_key_up(self):
375 """
376 Release the shift key.
377
378 """
379 self.do_command("shiftKeyUp", [])
373def scrollScreen(self,by1, value1, by2, value2):
374 self.driver.scroll(self.findMyElement(by1,value1), self.findMyElement(by2,value2))
218def key_down(self,locator,keycode):
219 """
220
221 Simulates a user pressing a key (without releasing it yet).
222
223
224 'locator' is an element locator
225 'keycode' is the numeric keycode of the key to be pressed, normally the
226 ASCII value of that key.
227 """
228 self.do_command("keyDown", [locator,keycode,])
128def mouse_scroll(steps=2, direction="up"):
129 steps_value = int(steps)
130
131 mm = MouseManager()
132
133 if direction.lower() == "up":
134 direction = mm.wheel_up
135 elif direction.lower()== "down":
136 direction = mm.wheel_down
137
138 mm.scroll(steps_value, direction)
170def scroll_up(self, scrolling):
171 Editor.scrbuf[scrolling:] = Editor.scrbuf[:-scrolling]
172 Editor.scrbuf[:scrolling] = [''] * scrolling
173 self.goto(0, 0)
174 self.wr("\x1bM" * scrolling)

Related snippets