Skip to content

Commit 04ad1fb

Browse files
committed
Update CDP Mode
1 parent ce5bd0f commit 04ad1fb

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

seleniumbase/core/browser_launcher.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1227,6 +1227,7 @@ def _on_a_cf_turnstile_page(driver):
12271227
'data-callback="onCaptchaSuccess"' in source
12281228
or "/challenge-platform/scripts/" in source
12291229
or 'id="challenge-widget-' in source
1230+
or "challenges.cloudf" in source
12301231
or "cf-turnstile-" in source
12311232
):
12321233
return True

seleniumbase/core/sb_cdp.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1661,11 +1661,16 @@ def gui_click_element(self, selector, timeframe=0.25):
16611661
self.loop.run_until_complete(self.page.wait())
16621662

16631663
def _on_a_cf_turnstile_page(self):
1664+
time.sleep(0.042)
16641665
source = self.get_page_source()
1666+
if not source or len(source) < 400:
1667+
time.sleep(0.22)
1668+
source = self.get_page_source()
16651669
if (
16661670
'data-callback="onCaptchaSuccess"' in source
16671671
or "/challenge-platform/scripts/" in source
16681672
or 'id="challenge-widget-' in source
1673+
or "challenges.cloudf" in source
16691674
or "cf-turnstile-" in source
16701675
):
16711676
return True
@@ -1795,6 +1800,7 @@ def gui_click_captcha(self):
17951800
self.loop.run_until_complete(self.page.evaluate(script))
17961801
self.loop.run_until_complete(self.page.wait())
17971802
with suppress(Exception):
1803+
time.sleep(0.08)
17981804
element_rect = self.get_gui_element_rect(selector, timeout=1)
17991805
e_x = element_rect["x"]
18001806
e_y = element_rect["y"]
@@ -1804,6 +1810,7 @@ def gui_click_captcha(self):
18041810
else:
18051811
y = e_y + 22
18061812
sb_config._saved_cf_x_y = (x, y)
1813+
time.sleep(0.08)
18071814
self.gui_click_x_y(x, y)
18081815

18091816
def __gui_drag_drop(self, x1, y1, x2, y2, timeframe=0.25, uc_lock=False):

0 commit comments

Comments
 (0)