Simulates pressing the LEFT 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")
| 6826 | time.sleep(0.1) |
| 6827 | |
| 6828 | def press_left_arrow(self, selector="body", times=1, by="css selector"): |
| 6829 | """Simulates pressing the LEFT Arrow on the keyboard. |
| 6830 | By default, "html" will be used as the CSS Selector target. |
| 6831 | You can specify how many times in-a-row the action happens.""" |
| 6832 | self.__check_scope() |
| 6833 | self._check_browser() |
| 6834 | if times < 1: |
| 6835 | return |
| 6836 | element = self.wait_for_element_present(selector) |
| 6837 | self.__demo_mode_highlight_if_active(selector, by) |
| 6838 | if not self.demo_mode and not self.slow_mode: |
| 6839 | self.__scroll_to_element(element, selector, by) |
| 6840 | for i in range(int(times)): |
| 6841 | try: |
| 6842 | element.send_keys(Keys.ARROW_LEFT) |
| 6843 | except Exception: |
| 6844 | self.wait_for_ready_state_complete() |
| 6845 | element = self.wait_for_element_visible(selector) |
| 6846 | element.send_keys(Keys.ARROW_LEFT) |
| 6847 | time.sleep(0.01) |
| 6848 | if self.slow_mode: |
| 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. |
no test coverage detected