Skip to content

Commit 4250c6d

Browse files
committed
Handle CAPTCHA updates
1 parent 0ada47b commit 4250c6d

File tree

1 file changed

+31
-1
lines changed

1 file changed

+31
-1
lines changed

seleniumbase/core/browser_launcher.py

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -835,6 +835,16 @@ def _uc_gui_click_captcha(
835835
'[data-callback="onCaptchaSuccess"]'
836836
):
837837
frame = '[data-callback="onCaptchaSuccess"]'
838+
elif (
839+
(
840+
driver.is_element_present('[name*="cf-turnstile-"]')
841+
or driver.is_element_present('[id*="cf-turnstile-"]')
842+
)
843+
and driver.is_element_present(
844+
'div > div > [style*="margin"][style*="padding"]'
845+
)
846+
):
847+
frame = 'div > div > [style*="margin"][style*="padding"]'
838848
else:
839849
return
840850
if driver.is_element_present('form[class*=center]'):
@@ -1007,6 +1017,26 @@ def uc_gui_handle_cf(driver, frame="iframe"):
10071017
and driver.is_element_present("div.spacer div[style]")
10081018
):
10091019
frame = "div.spacer div[style]"
1020+
elif (
1021+
(
1022+
driver.is_element_present('[name*="cf-turnstile-"]')
1023+
or driver.is_element_present('[id*="cf-turnstile-"]')
1024+
)
1025+
and driver.is_element_present(
1026+
'form div div[style*="margin"][style*="padding"]'
1027+
)
1028+
):
1029+
frame = 'form div div[style*="margin"][style*="padding"]'
1030+
elif (
1031+
(
1032+
driver.is_element_present('[name*="cf-turnstile-"]')
1033+
or driver.is_element_present('[id*="cf-turnstile-"]')
1034+
)
1035+
and driver.is_element_present(
1036+
'div > div > [style*="margin"][style*="padding"]'
1037+
)
1038+
):
1039+
frame = 'div > div > [style*="margin"][style*="padding"]'
10101040
else:
10111041
return
10121042
if not is_in_frame or needs_switch:
@@ -1028,7 +1058,7 @@ def uc_gui_handle_cf(driver, frame="iframe"):
10281058
active_element_css = js_utils.get_active_element_css(driver)
10291059
if (
10301060
active_element_css.startswith("div.cf-turnstile")
1031-
or active_element_css.startswith("div#PYMIw2")
1061+
or active_element_css.endswith(" > div" * 2)
10321062
):
10331063
found_checkbox = True
10341064
break

0 commit comments

Comments
 (0)