Skip to content

Commit

Permalink
Merge pull request #2975 from seleniumbase/handle-captcha-updates
Browse files Browse the repository at this point in the history
Handle CAPTCHA updates
  • Loading branch information
mdmintz authored Jul 29, 2024
2 parents 0ada47b + b5297ad commit 84cbe3f
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 2 deletions.
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

0 comments on commit 84cbe3f

Please sign in to comment.