(
driver,
frame="iframe",
retry=False,
blind=False,
ctype=None,
)
| 1341 | |
| 1342 | |
| 1343 | def _uc_gui_click_captcha( |
| 1344 | driver, |
| 1345 | frame="iframe", |
| 1346 | retry=False, |
| 1347 | blind=False, |
| 1348 | ctype=None, |
| 1349 | ): |
| 1350 | cdp_mode_on_at_start = __is_cdp_swap_needed(driver) |
| 1351 | if cdp_mode_on_at_start: |
| 1352 | return driver.cdp.gui_click_captcha() |
| 1353 | _on_a_captcha_page = None |
| 1354 | if ctype == "cf_t": |
| 1355 | if not _on_a_cf_turnstile_page(driver): |
| 1356 | return False |
| 1357 | else: |
| 1358 | _on_a_captcha_page = _on_a_cf_turnstile_page |
| 1359 | elif ctype == "g_rc": |
| 1360 | if not _on_a_g_recaptcha_page(driver): |
| 1361 | return False |
| 1362 | else: |
| 1363 | _on_a_captcha_page = _on_a_g_recaptcha_page |
| 1364 | else: |
| 1365 | if _on_a_g_recaptcha_page(driver): |
| 1366 | ctype = "g_rc" |
| 1367 | _on_a_captcha_page = _on_a_g_recaptcha_page |
| 1368 | elif _on_a_cf_turnstile_page(driver): |
| 1369 | ctype = "cf_t" |
| 1370 | _on_a_captcha_page = _on_a_cf_turnstile_page |
| 1371 | else: |
| 1372 | return False |
| 1373 | install_pyautogui_if_missing(driver) |
| 1374 | import pyautogui |
| 1375 | pyautogui = get_configured_pyautogui(pyautogui) |
| 1376 | i_x = None |
| 1377 | i_y = None |
| 1378 | x = None |
| 1379 | y = None |
| 1380 | visible_iframe = True |
| 1381 | gui_lock = FileLock(constants.MultiBrowser.PYAUTOGUILOCK) |
| 1382 | with gui_lock: # Prevent issues with multiple processes |
| 1383 | needs_switch = False |
| 1384 | width_ratio = 1.0 |
| 1385 | is_in_frame = js_utils.is_in_frame(driver) |
| 1386 | if is_in_frame and driver.is_element_present("#challenge-stage"): |
| 1387 | driver.switch_to.parent_frame() |
| 1388 | needs_switch = True |
| 1389 | is_in_frame = js_utils.is_in_frame(driver) |
| 1390 | if not is_in_frame: |
| 1391 | # Make sure the window is on top |
| 1392 | if __is_cdp_swap_needed(driver): |
| 1393 | driver.cdp.bring_active_window_to_front() |
| 1394 | else: |
| 1395 | page_actions.switch_to_window( |
| 1396 | driver, driver.current_window_handle, 2, uc_lock=False |
| 1397 | ) |
| 1398 | if IS_WINDOWS and not __is_cdp_swap_needed(driver): |
| 1399 | window_rect = driver.get_window_rect() |
| 1400 | width = window_rect["width"] |
no test coverage detected
searching dependent graphs…