Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle CAPTCHA updates #2975

Merged
merged 2 commits into from
Jul 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion seleniumbase/__version__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# seleniumbase package
__version__ = "4.29.3"
__version__ = "4.29.4"
32 changes: 31 additions & 1 deletion seleniumbase/core/browser_launcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -835,6 +835,16 @@ def _uc_gui_click_captcha(
'[data-callback="onCaptchaSuccess"]'
):
frame = '[data-callback="onCaptchaSuccess"]'
elif (
(
driver.is_element_present('[name*="cf-turnstile-"]')
or driver.is_element_present('[id*="cf-turnstile-"]')
)
and driver.is_element_present(
'div > div > [style*="margin"][style*="padding"]'
)
):
frame = 'div > div > [style*="margin"][style*="padding"]'
else:
return
if driver.is_element_present('form[class*=center]'):
Expand Down Expand Up @@ -1007,6 +1017,26 @@ def uc_gui_handle_cf(driver, frame="iframe"):
and driver.is_element_present("div.spacer div[style]")
):
frame = "div.spacer div[style]"
elif (
(
driver.is_element_present('[name*="cf-turnstile-"]')
or driver.is_element_present('[id*="cf-turnstile-"]')
)
and driver.is_element_present(
'form div div[style*="margin"][style*="padding"]'
)
):
frame = 'form div div[style*="margin"][style*="padding"]'
elif (
(
driver.is_element_present('[name*="cf-turnstile-"]')
or driver.is_element_present('[id*="cf-turnstile-"]')
)
and driver.is_element_present(
'div > div > [style*="margin"][style*="padding"]'
)
):
frame = 'div > div > [style*="margin"][style*="padding"]'
else:
return
if not is_in_frame or needs_switch:
Expand All @@ -1028,7 +1058,7 @@ def uc_gui_handle_cf(driver, frame="iframe"):
active_element_css = js_utils.get_active_element_css(driver)
if (
active_element_css.startswith("div.cf-turnstile")
or active_element_css.startswith("div#PYMIw2")
or active_element_css.endswith(" > div" * 2)
):
found_checkbox = True
break
Expand Down