MCPcopy Create free account
hub / github.com/seleniumbase/SeleniumBase / press_right_arrow

Method press_right_arrow

seleniumbase/fixtures/base_case.py:6851–6872  ·  view source on GitHub ↗

Simulates pressing the RIGHT Arrow on the keyboard. By default, "html" will be used as the CSS Selector target. You can specify how many times in-a-row the action happens.

(self, selector="body", times=1, by="css selector")

Source from the content-addressed store, hash-verified

6849 time.sleep(0.1)
6850
6851 def press_right_arrow(self, selector="body", times=1, by="css selector"):
6852 """Simulates pressing the RIGHT Arrow on the keyboard.
6853 By default, "html" will be used as the CSS Selector target.
6854 You can specify how many times in-a-row the action happens."""
6855 self.__check_scope()
6856 self._check_browser()
6857 if times < 1:
6858 return
6859 element = self.wait_for_element_present(selector)
6860 self.__demo_mode_highlight_if_active(selector, by)
6861 if not self.demo_mode and not self.slow_mode:
6862 self.__scroll_to_element(element, selector, by)
6863 for i in range(int(times)):
6864 try:
6865 element.send_keys(Keys.ARROW_RIGHT)
6866 except Exception:
6867 self.wait_for_ready_state_complete()
6868 element = self.wait_for_element_visible(selector)
6869 element.send_keys(Keys.ARROW_RIGHT)
6870 time.sleep(0.01)
6871 if self.slow_mode:
6872 time.sleep(0.1)
6873
6874 def scroll_to(self, selector, by="css selector", timeout=None):
6875 """Fast scroll to destination"""

Calls 9

__check_scopeMethod · 0.95
_check_browserMethod · 0.95
__scroll_to_elementMethod · 0.95
send_keysMethod · 0.45
sleepMethod · 0.45

Tested by

no test coverage detected