Skip to content

Commit 56b9040

Browse files
authored
Merge pull request #3881 from seleniumbase/cdp-mode-patch-51
CDP Mode: Patch 51
2 parents 877007e + 6ca2cdd commit 56b9040

File tree

3 files changed

+11
-8
lines changed

3 files changed

+11
-8
lines changed

examples/raw_bing_captcha.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,7 @@
22

33
with SB(uc=True, test=True) as sb:
44
url = "https://www.bing.com/turing/captcha/challenge"
5-
sb.uc_open_with_reconnect(url, 4)
5+
sb.activate_cdp_mode(url)
6+
sb.sleep(1)
67
sb.uc_gui_click_captcha()
8+
sb.sleep(1)

seleniumbase/__version__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
# seleniumbase package
2-
__version__ = "4.40.4"
2+
__version__ = "4.40.5"

seleniumbase/core/browser_launcher.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1377,9 +1377,9 @@ def _uc_gui_click_captcha(
13771377
):
13781378
frame = '[data-testid*="challenge-"] div'
13791379
elif driver.is_element_present(
1380-
"form.turnstile div#turnstile-widget div:not([class])"
1380+
"div#turnstile-widget div:not([class])"
13811381
):
1382-
frame = "form.turnstile #turnstile-widget div:not([class])"
1382+
frame = "div#turnstile-widget div:not([class])"
13831383
elif driver.is_element_present(
13841384
'form div:not([class]):has(input[name*="cf-turn"])'
13851385
):
@@ -1667,7 +1667,6 @@ def _uc_gui_handle_captcha_(driver, frame="iframe", ctype=None):
16671667
driver.set_window_rect(win_x, win_y, width, height)
16681668
time.sleep(0.33)
16691669
tab_up_first = False
1670-
special_form = False
16711670
if ctype == "cf_t":
16721671
if (
16731672
driver.is_element_present(".cf-turnstile-wrapper iframe")
@@ -1701,7 +1700,6 @@ def _uc_gui_handle_captcha_(driver, frame="iframe", ctype=None):
17011700
):
17021701
frame = 'form div:not([class]):has(input[name*="cf-turn"])'
17031702
tab_up_first = True
1704-
special_form = True
17051703
elif (
17061704
driver.is_element_present('[src*="/turnstile/"]')
17071705
and driver.is_element_present("form div:not(:has(*))")
@@ -1715,6 +1713,10 @@ def _uc_gui_handle_captcha_(driver, frame="iframe", ctype=None):
17151713
)
17161714
):
17171715
frame = "body > div#check > div:not([class])"
1716+
elif driver.is_element_present(
1717+
"div#turnstile-widget div:not([class])"
1718+
):
1719+
frame = "div#turnstile-widget div:not([class])"
17181720
elif driver.is_element_present(".cf-turnstile-wrapper"):
17191721
frame = ".cf-turnstile-wrapper"
17201722
elif driver.is_element_present('[class="cf-turnstile"]'):
@@ -1759,8 +1761,7 @@ def _uc_gui_handle_captcha_(driver, frame="iframe", ctype=None):
17591761
active_element_css = js_utils.get_active_element_css(driver)
17601762
if (
17611763
active_element_css.startswith(selector)
1762-
or active_element_css.endswith(" > div" * 2)
1763-
or (special_form and active_element_css.endswith(" div"))
1764+
or active_element_css.endswith(" div")
17641765
or (ctype == "g_rc" and "frame[name" in active_element_css)
17651766
):
17661767
found_checkbox = True

0 commit comments

Comments
 (0)