This method does a few things to click a CAPTCHA: 1. Checks to see if a CAPTCHA is on the current page. 2. If found, calls `click_with_offset(*)` to click it.
(self)
| 1675 | await element.mouse_click_with_offset_async(x=x, y=y, center=center) |
| 1676 | |
| 1677 | async def solve_captcha(self): |
| 1678 | """This method does a few things to click a CAPTCHA: |
| 1679 | 1. Checks to see if a CAPTCHA is on the current page. |
| 1680 | 2. If found, calls `click_with_offset(*)` to click it.""" |
| 1681 | await self.sleep(0.11) |
| 1682 | source = await self.get_html() |
| 1683 | if await self.__on_a_cf_turnstile_page(source): |
| 1684 | pass |
| 1685 | elif await self.__on_a_g_recaptcha_page(source): |
| 1686 | result = await self.__gui_click_recaptcha() |
| 1687 | return result |
| 1688 | elif await self.__on_an_incapsula_hcaptcha_page(): |
| 1689 | result = await self.__cdp_click_incapsula_hcaptcha() |
| 1690 | return result |
| 1691 | elif await self.__on_a_friendly_captcha_page(): |
| 1692 | result = await self.__gui_click_friendly_captcha() |
| 1693 | return result |
| 1694 | else: |
| 1695 | return False |
| 1696 | selector = None |
| 1697 | if await self.is_element_present('[class="cf-turnstile"]'): |
| 1698 | selector = '[class="cf-turnstile"]' |
| 1699 | elif await self.is_element_present("#challenge-form div > div"): |
| 1700 | selector = "#challenge-form div > div" |
| 1701 | elif await self.is_element_present('[style="display: grid;"] div div'): |
| 1702 | selector = '[style="display: grid;"] div div' |
| 1703 | await self.sleep(0.025) |
| 1704 | await self.set_attributes(selector, "style", "text-align: left;") |
| 1705 | await self.sleep(0.025) |
| 1706 | elif await self.is_element_present("[class*=spacer] + div div"): |
| 1707 | selector = '[class*=spacer] + div div' |
| 1708 | elif await self.is_element_present(".spacer div:not([class])"): |
| 1709 | selector = ".spacer div:not([class])" |
| 1710 | elif await self.is_element_present('[data-testid*="challenge-"] div'): |
| 1711 | selector = '[data-testid*="challenge-"] div' |
| 1712 | elif await self.is_element_present( |
| 1713 | "div#turnstile-widget div:not([class])" |
| 1714 | ): |
| 1715 | selector = "div#turnstile-widget div:not([class])" |
| 1716 | elif await self.is_element_present("ngx-turnstile div:not([class])"): |
| 1717 | selector = "ngx-turnstile div:not([class])" |
| 1718 | elif await self.is_element_present( |
| 1719 | 'form div:not([class]):has(input[name*="cf-turn"])' |
| 1720 | ): |
| 1721 | selector = 'form div:not([class]):has(input[name*="cf-turn"])' |
| 1722 | elif await self.is_element_present("form div:not(:has(*))"): |
| 1723 | selector = "form div:not(:has(*))" |
| 1724 | elif await self.is_element_present( |
| 1725 | "body > div#check > div:not([class])" |
| 1726 | ): |
| 1727 | selector = "body > div#check > div:not([class])" |
| 1728 | elif await self.is_element_present(".cf-turnstile-wrapper"): |
| 1729 | selector = ".cf-turnstile-wrapper" |
| 1730 | elif await self.is_element_present( |
| 1731 | '[id*="turnstile"] div:not([class])' |
| 1732 | ): |
| 1733 | selector = '[id*="turnstile"] div:not([class])' |
| 1734 | elif await self.is_element_present( |
no test coverage detected