Similar to click(), but pauses for a brief moment before clicking. When used in combination with setting the user-agent, you can often bypass bot-detection by tricking websites into thinking that you're not a bot. (Useful on websites that block web automation tools.)
(self, selector, by="css selector", timeout=None)
| 677 | self.__set_esc_skip() |
| 678 | |
| 679 | def slow_click(self, selector, by="css selector", timeout=None): |
| 680 | """Similar to click(), but pauses for a brief moment before clicking. |
| 681 | When used in combination with setting the user-agent, you can often |
| 682 | bypass bot-detection by tricking websites into thinking that you're |
| 683 | not a bot. (Useful on websites that block web automation tools.) |
| 684 | To set the user-agent, use: ``--agent=AGENT``. |
| 685 | Here's an example message from GitHub's bot-blocker: |
| 686 | ``You have triggered an abuse detection mechanism...`` """ |
| 687 | self.__check_scope() |
| 688 | if not timeout: |
| 689 | timeout = settings.SMALL_TIMEOUT |
| 690 | if self.timeout_multiplier and timeout == settings.SMALL_TIMEOUT: |
| 691 | timeout = self.__get_new_timeout(timeout) |
| 692 | if not self.demo_mode and not self.slow_mode: |
| 693 | self.click(selector, by=by, timeout=timeout, delay=1.05) |
| 694 | elif self.slow_mode: |
| 695 | self.click(selector, by=by, timeout=timeout, delay=0.65) |
| 696 | else: |
| 697 | # Demo Mode already includes a small delay |
| 698 | self.click(selector, by=by, timeout=timeout, delay=0.25) |
| 699 | |
| 700 | def double_click(self, selector, by="css selector", timeout=None): |
| 701 | self.__check_scope() |