Update CDP Mode examples

This commit is contained in:
Michael Mintz 2025-02-24 16:07:45 -05:00
parent b8d308d3b4
commit 25365eface
3 changed files with 5 additions and 5 deletions

View File

@ -144,7 +144,7 @@ with SB(uc=True, test=True, locale_code="en", ad_block=True) as sb:
sb.sleep(0.5)
sb.scroll_into_view("a#advSearch")
sb.sleep(0.5)
sb.cdp.mouse_click("a#advSearch")
sb.cdp.click("a#advSearch")
sb.sleep(1.2)
sb.cdp.click('img[src*="img/pokedex/detail/025.png"]')
sb.cdp.assert_text("Pikachu", 'div[class*="title"]')

View File

@ -1,16 +1,16 @@
"""Using CDP Mode with PyAutoGUI to bypass CAPTCHAs."""
from seleniumbase import SB
with SB(uc=True, test=True, locale_code="en", incognito=True) as sb:
with SB(uc=True, test=True, locale_code="en", guest=True) as sb:
url = "https://www.cloudflare.com/login"
sb.activate_cdp_mode(url)
sb.sleep(3)
sb.uc_gui_handle_captcha() # PyAutoGUI press Tab and Spacebar
sb.sleep(2)
with SB(uc=True, test=True, locale_code="en", incognito=True) as sb:
with SB(uc=True, test=True, locale_code="en", guest=True) as sb:
url = "https://www.cloudflare.com/login"
sb.activate_cdp_mode(url)
sb.sleep(2)
sb.sleep(3)
sb.uc_gui_click_captcha() # PyAutoGUI click. (Linux needs it)
sb.sleep(2)

View File

@ -14,7 +14,7 @@ with SB(uc=True, test=True, locale_code="en", ad_block=True) as sb:
sb.sleep(0.5)
sb.scroll_into_view("a#advSearch")
sb.sleep(0.5)
sb.cdp.mouse_click("a#advSearch")
sb.cdp.click("a#advSearch")
sb.sleep(1.2)
sb.cdp.click('img[src*="img/pokedex/detail/025.png"]')
sb.cdp.assert_text("Pikachu", 'div[class*="title"]')