(self, use_cdp=False)
| 2243 | return False |
| 2244 | |
| 2245 | def __gui_click_recaptcha(self, use_cdp=False): |
| 2246 | selector = None |
| 2247 | if self.is_element_visible('iframe[title="reCAPTCHA"]'): |
| 2248 | selector = 'iframe[title="reCAPTCHA"]' |
| 2249 | else: |
| 2250 | return False |
| 2251 | time.sleep(0.25) |
| 2252 | self.loop.run_until_complete(self.page.wait(0.1)) |
| 2253 | time.sleep(0.25) |
| 2254 | with suppress(Exception): |
| 2255 | element_rect = self.get_element_rect(selector, timeout=0.1) |
| 2256 | e_x = element_rect["x"] |
| 2257 | e_y = element_rect["y"] |
| 2258 | window_rect = self.get_window_rect() |
| 2259 | win_width = window_rect["innerWidth"] |
| 2260 | win_height = window_rect["innerHeight"] |
| 2261 | if ( |
| 2262 | e_x > 1040 |
| 2263 | and e_y > 640 |
| 2264 | and abs(win_width - e_x) < 110 |
| 2265 | and abs(win_height - e_y) < 110 |
| 2266 | ): |
| 2267 | # Probably the invisible reCAPTCHA in the bottom right corner |
| 2268 | return False |
| 2269 | gui_element_rect = self.get_gui_element_rect(selector, timeout=1) |
| 2270 | gui_e_x = gui_element_rect["x"] |
| 2271 | gui_e_y = gui_element_rect["y"] |
| 2272 | x_offset = 26 |
| 2273 | y_offset = 35 |
| 2274 | if shared_utils.is_windows(): |
| 2275 | x_offset = 29 |
| 2276 | x = gui_e_x + x_offset |
| 2277 | y = gui_e_y + y_offset |
| 2278 | sb_config._saved_cf_x_y = (x, y) |
| 2279 | time.sleep(0.08) |
| 2280 | if use_cdp: |
| 2281 | time.sleep(0.03) |
| 2282 | gui_lock = FileLock(constants.MultiBrowser.PYAUTOGUILOCK) |
| 2283 | with gui_lock: # Prevent issues with multiple processes |
| 2284 | self.bring_active_window_to_front() |
| 2285 | time.sleep(0.056) |
| 2286 | self.click_with_offset(selector, x_offset, y_offset) |
| 2287 | time.sleep(0.056) |
| 2288 | else: |
| 2289 | self.gui_click_x_y(x, y) |
| 2290 | return True |
| 2291 | return False |
| 2292 | |
| 2293 | def __gui_slide_datadome_captcha(self): |
| 2294 | iframe = 'body > iframe[src*="/geo.captcha-delivery.com/captcha/"]' |
no test coverage detected