From 52e0957c1d6767fbde7a051b1c5d568acb023be4 Mon Sep 17 00:00:00 2001
From: Michael Mintz Having fun yet?!?
")
@@ -512,22 +513,21 @@ def test_presentation_4(self):
with SB(uc=True, test=True, ad_block=True) as sb:
url = "https://www.walmart.com/"
sb.activate_cdp_mode(url)
- sb.sleep(2.5)
- sb.cdp.click_if_visible('[data-automation-id*="close-mark"]')
- sb.sleep(0.3)
- sb.cdp.mouse_click('input[aria-label="Search"]')
+ sb.sleep(2.8)
+ sb.click('input[aria-label="Search"]')
sb.sleep(1.2)
search = "Settlers of Catan Board Game"
required_text = "Catan"
- sb.cdp.press_keys('input[aria-label="Search"]', search + "\n")
+ sb.press_keys('input[aria-label="Search"]', search + "\n")
sb.sleep(3.8)
if sb.is_element_visible("#px-captcha"):
- sb.cdp.gui_click_and_hold("#px-captcha", 12)
+ sb.cdp.gui_click_and_hold("#px-captcha", 7.2)
sb.sleep(3.2)
if sb.is_element_visible("#px-captcha"):
- sb.cdp.gui_click_and_hold("#px-captcha", 12)
+ sb.cdp.gui_click_and_hold("#px-captcha", 4.2)
sb.sleep(3.2)
- sb.cdp.remove_elements('[data-testid="skyline-ad"]')
+ sb.remove_elements('[data-testid="skyline-ad"]')
+ sb.remove_elements('[data-testid="sba-container"]')
print('*** Walmart Search for "%s":' % search)
print(' (Results must contain "%s".)' % required_text)
unique_item_text = []
@@ -570,24 +570,24 @@ def test_presentation_4(self):
sb.activate_cdp_mode(url)
sb.sleep(2.5)
sb.remove_element("div > div > article")
- sb.cdp.scroll_into_view('input[type="search"]')
+ sb.scroll_into_view('input[type="search"]')
close_btn = ".notification-alert-wrapper__close-button"
- sb.cdp.click_if_visible(close_btn)
- sb.cdp.click("input#search-suggestion-input")
+ sb.click_if_visible(close_btn)
+ sb.click("input#search-suggestion-input")
sb.sleep(0.2)
search = "Avocado Smoked Salmon"
required_text = "Salmon"
- sb.cdp.press_keys("input#search-suggestion-input", search)
+ sb.press_keys("input#search-suggestion-input", search)
sb.sleep(0.8)
- sb.cdp.click("#suggestion-0 a span")
+ sb.click("#suggestion-0 a span")
sb.sleep(0.8)
- sb.cdp.click_if_visible(close_btn)
- sb.sleep(2.8)
+ sb.click_if_visible(close_btn)
+ sb.sleep(3.2)
print('*** Albertsons Search for "%s":' % search)
print(' (Results must contain "%s".)' % required_text)
unique_item_text = []
item_selector = 'a[href*="/meal-plans-recipes/shop/"]'
- items = sb.cdp.find_elements(item_selector)
+ items = sb.find_elements(item_selector)
for item in items:
sb.sleep(0.06)
if required_text in item.text:
@@ -610,34 +610,34 @@ def test_presentation_4(self):
with SB(uc=True, test=True, locale="en", ad_block=True) as sb:
url = "https://www.easyjet.com/en/"
sb.activate_cdp_mode(url)
- sb.sleep(2.5)
- sb.cdp.click_if_visible("button#ensCloseBanner")
+ sb.sleep(2)
+ sb.click_if_visible("button#ensCloseBanner")
sb.sleep(1.2)
- sb.cdp.click('input[name="from"]')
+ sb.click('input[name="from"]')
sb.sleep(1.2)
- sb.cdp.type('input[name="from"]', "London")
+ sb.type('input[name="from"]', "London Gatwick")
sb.sleep(0.6)
- sb.cdp.click_if_visible("button#ensCloseBanner")
+ sb.click_if_visible("button#ensCloseBanner")
sb.sleep(0.6)
- sb.cdp.click('span[data-testid="airport-name"]')
+ sb.click('span[data-testid="airport-name"]')
sb.sleep(1.2)
- sb.cdp.type('input[name="to"]', "Venice")
+ sb.type('input[name="to"]', "Paris")
sb.sleep(1.2)
- sb.cdp.click('span[data-testid="airport-name"]')
+ sb.click('span[data-testid="airport-name"]')
sb.sleep(1.2)
- sb.cdp.click('input[name="when"]')
+ sb.click('input[name="when"]')
sb.sleep(1.2)
sb.cdp.click(
'[data-testid="month"]:last-of-type'
' [aria-disabled="false"]'
)
sb.sleep(1.2)
- sb.cdp.click(
+ sb.click(
'[data-testid="month"]:last-of-type'
' [aria-disabled="false"]'
)
sb.sleep(1.2)
- sb.cdp.click('button[data-testid="submit"]')
+ sb.click('button[data-testid="submit"]')
sb.sleep(3.5)
sb.connect()
sb.sleep(4.2)
@@ -724,26 +724,26 @@ def test_presentation_4(self):
url = "https://www.bestwestern.com/en_US.html"
sb.activate_cdp_mode(url)
sb.sleep(2.5)
- sb.cdp.click_if_visible(".onetrust-close-btn-handler")
+ sb.click_if_visible(".onetrust-close-btn-handler")
sb.sleep(1)
- sb.cdp.click("input#destination-input")
+ sb.click("input#destination-input")
sb.sleep(2)
location = "Palm Springs, CA, USA"
- sb.cdp.press_keys("input#destination-input", location)
+ sb.press_keys("input#destination-input", location)
sb.sleep(1)
- sb.cdp.click("ul#google-suggestions li")
+ sb.click("ul#google-suggestions li")
sb.sleep(1)
- sb.cdp.click("button#btn-modify-stay-update")
+ sb.click("button#btn-modify-stay-update")
sb.sleep(4)
- sb.cdp.click("label#available-label")
+ sb.click("label#available-label")
sb.sleep(2.5)
print("Best Western Hotels in %s:" % location)
- summary_details = sb.cdp.get_text("#summary-details-column")
+ summary_details = sb.get_text("#summary-details-column")
dates = summary_details.split("DESTINATION")[-1]
dates = dates.split(" CHECK-OUT")[0].strip() + " CHECK-OUT"
dates = dates.replace(" ", " ")
print("(Dates: %s)" % dates)
- flip_cards = sb.cdp.select_all(".flipCard")
+ flip_cards = sb.select_all(".flipCard")
for i, flip_card in enumerate(flip_cards):
hotel = flip_card.query_selector(".hotelName")
price = flip_card.query_selector(".priceSection")
@@ -865,17 +865,17 @@ def test_presentation_4(self):
url = "https://www.nordstrom.com/"
sb.activate_cdp_mode(url)
sb.sleep(2.2)
- sb.cdp.click("input#keyword-search-input")
+ sb.click("input#keyword-search-input")
sb.sleep(0.8)
search = "cocktail dresses for women teal"
- sb.cdp.press_keys("input#keyword-search-input", search + "\n")
+ sb.press_keys("input#keyword-search-input", search + "\n")
sb.sleep(2.2)
- for i in range(16):
- sb.cdp.scroll_down(16)
- sb.sleep(0.16)
- print('\n\n*** Nordstrom Search for "%s":' % search)
+ for i in range(17):
+ sb.scroll_down(16)
+ sb.sleep(0.14)
+ print('*** Nordstrom Search for "%s":' % search)
unique_item_text = []
- items = sb.cdp.find_elements("article")
+ items = sb.find_elements("article")
for item in items:
description = item.querySelector("article h3")
if description and description.text not in unique_item_text:
diff --git a/examples/raw_bing_captcha.py b/examples/raw_bing_captcha.py
index 052d7cb4160..1cb47ee159b 100644
--- a/examples/raw_bing_captcha.py
+++ b/examples/raw_bing_captcha.py
@@ -6,4 +6,3 @@
sb.sleep(1)
sb.solve_captcha()
sb.sleep(2)
- breakpoint()
From fccc3f59801c7a04074ac556ee14847fd7bfa27a Mon Sep 17 00:00:00 2001
From: Michael Mintz
SeleniumBase is a browser automation framework for the modern web. Both new and experienced Python users alike can easily get started. With special stealth features like UC Mode and CDP Mode, you'll be evading bot-detection and bypassing CAPTCHAs in minutes.
+SeleniumBase is a browser automation framework that empowers software teams to innovate faster and handle modern web challenges with ease. With stealth options like CDP Mode, you'll avoid the usual restrictions imposed by websites deploying bot-detection services.
-------- đ Learn from [**over 200 examples** in the **SeleniumBase/examples/** folder](https://github.com/seleniumbase/SeleniumBase/tree/master/examples). -đ Stealth modes: UC Mode and CDP Mode help you evade bot-detection. +đ Stealth modes: UC Mode and CDP Mode can bypass bot-detection, solve CAPTCHAs, and call advanced methods from the Chrome Devtools Protocol. -âšī¸ Most scripts run with rawpython, although some scripts use Syntax Formats that expect pytest (a Python unit-testing framework included with SeleniumBase that can discover, collect, and run tests automatically).
+âšī¸ Many examples run with raw python, although some use Syntax Formats that expect pytest (a Python unit-testing framework included with SeleniumBase that can discover, collect, and run tests automatically).
--------
diff --git a/examples/cdp_mode/ReadMe.md b/examples/cdp_mode/ReadMe.md
index 18e194b60db..ed0283f5c4e 100644
--- a/examples/cdp_mode/ReadMe.md
+++ b/examples/cdp_mode/ReadMe.md
@@ -2,7 +2,7 @@
## [sb_cdp), which doesn't use WebDriver at all, and has a slightly different setup.
+đ SeleniumBase CDP Mode is a stealth mode of SeleniumBase that uses the Chrome Devtools Protocol (via MyCDP) to control the web browser. CDP Mode can be used either as a subset of SeleniumBase UC Mode, or via Pure CDP Mode (sb_cdp), which doesn't use WebDriver at all, and has a slightly different setup.
--------
@@ -55,6 +55,7 @@ with SB(uc=True, test=True, locale="en") as sb:
sb.activate_cdp_mode(url)
sb.sleep(2)
sb.solve_captcha()
+ sb.sleep(2)
```
@@ -63,7 +64,7 @@ with SB(uc=True, test=True, locale="en") as sb:
--------
-`sb.cdp.gui_click_element(selector)` lets you click on elements using `PyAutoGUI`. Example:
+You can also use `PyAutoGUI` to click on elements with the mouse by calling `sb.cdp.gui_click_element(selector)`. Example:
```python
from seleniumbase import SB
@@ -86,7 +87,7 @@ Eg. `sb.cdp.gui_click_element("#turnstile-widget div")`
In most cases, `sb.solve_captcha()` is good enough for CF Turnstiles without needing `sb.cdp.gui_click_element(selector)`. (See [SeleniumBase/examples/cdp_mode/raw_planetmc.py](https://github.com/seleniumbase/SeleniumBase/blob/master/examples/cdp_mode/raw_planetmc.py))
-âšī¸ Note that `PyAutoGUI` is an optional dependency. If calling a method that uses it when not already installed, then `SeleniumBase` installs `PyAutoGUI` at run-time.
+âšī¸ Note that `PyAutoGUI` is an optional dependency. If calling a method that uses it when not already installed, then `SeleniumBase` installs `PyAutoGUI` at runtime.
--------
diff --git a/help_docs/uc_mode.md b/help_docs/uc_mode.md
index 611f04290c9..1b3c6503aad 100644
--- a/help_docs/uc_mode.md
+++ b/help_docs/uc_mode.md
@@ -4,7 +4,7 @@
đ¤ SeleniumBase UC Mode (Undetected-Chromedriver Mode) allows bots to appear human, which lets them evade detection from anti-bot services that try to block them or trigger CAPTCHAs on various websites.
-> #### (For the successor to default UC Mode, see **[CDP Mode đ](https://github.com/seleniumbase/SeleniumBase/blob/master/examples/cdp_mode/ReadMe.md)**)
+> ### (For the successor to plain UC Mode, see **[CDP Mode đ](https://github.com/seleniumbase/SeleniumBase/blob/master/examples/cdp_mode/ReadMe.md)**)
---
@@ -28,11 +28,7 @@
----
-đ¤ UC Mode is based on [undetected-chromedriver](https://github.com/ultrafunkamsterdam/undetected-chromedriver). UC Mode includes multiple updates, fixes, and improvements, such as:
-
-* Automatically changing user-agents to prevent detection.
-* Automatically setting various Chromium args as needed.
-* Has special `uc_*()` methods for bypassing CAPTCHAs.
+đ¤ UC Mode is based on [undetected-chromedriver](https://github.com/ultrafunkamsterdam/undetected-chromedriver). UC Mode includes multiple updates, fixes, and improvements, such as having special uc_*() methods for bypassing CAPTCHAs.
đ¤ Here's a simple example with the Driver manager:
@@ -110,10 +106,10 @@ with SB(uc=True, test=True, incognito=True, locale="en") as sb:
submit_button = 'span:contains("Check Authority")'
sb.uc_open_with_reconnect(url) # The bot-check is later
sb.type(input_field, "github.com/seleniumbase/SeleniumBase")
- sb.reconnect(0.1)
- sb.uc_click(submit_button, reconnect_time=4)
+ sb.uc_click(submit_button, reconnect_time=3.25)
sb.uc_gui_click_captcha()
- sb.wait_for_text_not_visible("Checking", timeout=12)
+ sb.wait_for_text_not_visible("Checking", timeout=15)
+ sb.click_if_visible('button[data-cky-tag="close-button"]')
sb.highlight('p:contains("github.com/seleniumbase/SeleniumBase")')
sb.highlight('a:contains("Top 100 backlinks")')
sb.set_messenger_theme(location="bottom_center")
@@ -122,20 +118,6 @@ with SB(uc=True, test=True, incognito=True, locale="en") as sb:
-đ¤ Here, the CAPTCHA appears after clicking to go to the sign-in screen:
-
-```python
-from seleniumbase import SB
-
-with SB(uc=True, test=True, ad_block=True) as sb:
- url = "https://www.thaiticketmajor.com/concert/"
- sb.uc_open_with_reconnect(url, 6.111)
- sb.uc_click("button.btn-signin", 4.1)
- sb.uc_gui_click_captcha()
-```
-
-
-
--------
đ¤ On Linux, use `sb.uc_gui_click_captcha()` to handle CAPTCHAs (Cloudflare Turnstiles):
@@ -169,24 +151,21 @@ The 2nd print() should output V
### đ¤ Here are some examples that use UC Mode:
* [SeleniumBase/examples/verify_undetected.py](https://github.com/seleniumbase/SeleniumBase/blob/master/examples/verify_undetected.py)
-* [SeleniumBase/examples/raw_bing_captcha.py](https://github.com/seleniumbase/SeleniumBase/blob/master/examples/raw_bing_captcha.py)
+* [SeleniumBase/examples/raw_turnstile.py](https://github.com/seleniumbase/SeleniumBase/blob/master/examples/raw_turnstile.py)
+* [SeleniumBase/examples/raw_form_turnstile.py](https://github.com/seleniumbase/SeleniumBase/blob/master/examples/raw_form_turnstile.py)
* [SeleniumBase/examples/raw_uc_mode.py](https://github.com/seleniumbase/SeleniumBase/blob/master/examples/raw_uc_mode.py)
-* [SeleniumBase/examples/raw_cf.py](https://github.com/seleniumbase/SeleniumBase/blob/master/examples/raw_cf.py)
+
+
--------
đ¤ Here's an example where incognito=True is needed for bypassing detection:
-* [SeleniumBase/examples/raw_pixelscan.py](https://github.com/seleniumbase/SeleniumBase/blob/master/examples/raw_pixelscan.py)
-
```python
from seleniumbase import SB
with SB(uc=True, incognito=True, test=True) as sb:
sb.driver.uc_open_with_reconnect("https://pixelscan.net/", 10)
- sb.remove_elements("jdiv") # Remove chat widgets
- sb.highlight("span.text-success", loops=8)
- sb.highlight(".bot-detection-context", loops=10, scroll=False)
sb.sleep(2)
```
@@ -194,16 +173,6 @@ with SB(uc=True, incognito=True, test=True) as sb:
--------
-### đ¤ Here are some UC Mode examples that bypass CAPTCHAs when clicking is required:
-* [SeleniumBase/examples/raw_pyautogui.py](https://github.com/seleniumbase/SeleniumBase/blob/master/examples/raw_pyautogui.py)
-* [SeleniumBase/examples/raw_turnstile.py](https://github.com/seleniumbase/SeleniumBase/blob/master/examples/raw_turnstile.py)
-* [SeleniumBase/examples/raw_form_turnstile.py](https://github.com/seleniumbase/SeleniumBase/blob/master/examples/raw_form_turnstile.py)
-* [SeleniumBase/examples/uc_cdp_events.py](https://github.com/seleniumbase/SeleniumBase/blob/master/examples/uc_cdp_events.py)
-
-
-
---------
-
### đ¤ Here are the SeleniumBase UC Mode methods: (**`--uc`** / **`uc=True`**)
```python
From a798ffed95d5a001459a4965ece21fdd8e4355ae Mon Sep 17 00:00:00 2001
From: Michael Mintz
Date: Wed, 5 Nov 2025 12:09:32 -0500
Subject: [PATCH 5/5] Version 4.44.7
---
seleniumbase/__version__.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/seleniumbase/__version__.py b/seleniumbase/__version__.py
index 578d6525627..f8502eb5fb7 100755
--- a/seleniumbase/__version__.py
+++ b/seleniumbase/__version__.py
@@ -1,2 +1,2 @@
# seleniumbase package
-__version__ = "4.44.6"
+__version__ = "4.44.7"