Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: seleniumbase/SeleniumBase
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v4.34.13
Choose a base ref
...
head repository: seleniumbase/SeleniumBase
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v4.34.14
Choose a head ref
  • 5 commits
  • 12 files changed
  • 2 contributors

Commits on Feb 13, 2025

  1. Update CDP Mode

    mdmintz committed Feb 13, 2025

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    32960b6 View commit details
  2. Update examples

    mdmintz committed Feb 13, 2025

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    d028e3b View commit details
  3. Refresh mkdocs dependencies

    mdmintz committed Feb 13, 2025
    Copy the full SHA
    31fccae View commit details
  4. Version 4.34.14

    mdmintz committed Feb 13, 2025
    Copy the full SHA
    23d7dea View commit details
  5. Merge pull request #3514 from seleniumbase/cdp-mode-patch-33

    CDP Mode - Patch 33
    mdmintz authored Feb 13, 2025
    Copy the full SHA
    de9295b View commit details
2 changes: 1 addition & 1 deletion examples/boilerplates/samples/google_test.py
Original file line number Diff line number Diff line change
@@ -4,7 +4,7 @@
from .google_objects import HomePage, ResultsPage
except Exception:
from google_objects import HomePage, ResultsPage
BaseCase.main(__name__, __file__)
BaseCase.main(__name__, __file__, "--uc")


class GoogleTests(BaseCase):
2 changes: 1 addition & 1 deletion examples/boilerplates/samples/test_page_objects.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""An example using the Classic Page Object Model."""
from seleniumbase import BaseCase
BaseCase.main(__name__, __file__)
BaseCase.main(__name__, __file__, "--uc")


class GooglePage:
2 changes: 1 addition & 1 deletion examples/cdp_mode/raw_priceline.py
Original file line number Diff line number Diff line change
@@ -27,7 +27,7 @@
sb.sleep(0.8)
for y in range(1, 9):
sb.scroll_to_y(y * 400)
sb.sleep(1.25)
sb.sleep(0.75)
hotel_names = sb.find_elements('a[data-autobot-element-id*="HOTEL_NAME"]')
hotel_prices = sb.find_elements('span[font-size="4,,,5"]')
print("Priceline Hotels in %s:" % location)
2 changes: 1 addition & 1 deletion examples/presenter/uc_presentation_4.py
Original file line number Diff line number Diff line change
@@ -796,7 +796,7 @@ def test_presentation_4(self):
sb.sleep(0.8)
for y in range(1, 9):
sb.scroll_to_y(y * 400)
sb.sleep(1.25)
sb.sleep(0.75)
hotel_names = sb.find_elements(
'a[data-autobot-element-id*="HOTEL_NAME"]'
)
2 changes: 1 addition & 1 deletion examples/raw_google.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from seleniumbase import SB

with SB(test=True) as sb:
with SB(test=True, uc=True) as sb:
sb.open("https://google.com/ncr")
sb.type('[title="Search"]', "SeleniumBase GitHub page\n")
sb.click('[href*="github.com/seleniumbase/"]')
4 changes: 2 additions & 2 deletions examples/raw_gui_click.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import sys
from seleniumbase import SB

# An incomplete UserAgent forces CAPTCHA-solving on macOS
agent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) Chrome/126.0.0.0"
# An bad UserAgent forces CAPTCHA-solving on macOS
agent = "cool"
if "linux" in sys.platform or "win32" in sys.platform:
agent = None # Use the default UserAgent

4 changes: 2 additions & 2 deletions examples/raw_pyautogui.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import sys
from seleniumbase import SB

# An incomplete UserAgent forces CAPTCHA-solving on macOS
agent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) Chrome/126.0.0.0"
# An bad UserAgent forces CAPTCHA-solving on macOS
agent = "cool"
if "linux" in sys.platform or "win32" in sys.platform:
agent = None # Use the default UserAgent

4 changes: 2 additions & 2 deletions examples/test_cdp_ad_blocking.py
Original file line number Diff line number Diff line change
@@ -5,8 +5,8 @@
class CDPNetworkBlockingTests(BaseCase):
def test_cdp_network_blocking(self):
self.open("about:blank")
if not self.is_chromium():
message = "This test is only for Chromium browsers!"
if self._reuse_session or not self.is_chromium():
message = "Skipping test if reusing session or not Chromium!"
print(message)
self.skip(message)
self.execute_cdp_cmd(
2 changes: 1 addition & 1 deletion mkdocs_build/requirements.txt
Original file line number Diff line number Diff line change
@@ -14,7 +14,7 @@ pathspec==0.12.1
Babel==2.17.0
paginate==0.5.7
mkdocs==1.6.1
mkdocs-material==9.6.3
mkdocs-material==9.6.4
mkdocs-exclude-search==0.6.6
mkdocs-simple-hooks==0.1.5
mkdocs-material-extensions==1.3.1
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.34.13"
__version__ = "4.34.14"
26 changes: 16 additions & 10 deletions seleniumbase/undetected/__init__.py
Original file line number Diff line number Diff line change
@@ -454,17 +454,20 @@ def reconnect(self, timeout=0.1):
self.start_session()
time.sleep(0.0075)
with suppress(Exception):
for i in range(5):
if self.current_url.startswith("chrome-extension://"):
for window_handle in self.window_handles:
self.switch_to.window(window_handle)
if self.current_url.startswith(
"chrome-extension://"
):
self.close()
if self.service.is_connectable():
self.stop_client()
self.service.stop()
self.service.start()
self.start_session()
time.sleep(0.0075)
else:
break
time.sleep(0.003)
with suppress(Exception):
self.switch_to.window(self.window_handles[-1])
self._is_connected = True

def disconnect(self):
@@ -487,17 +490,20 @@ def connect(self):
self.start_session()
time.sleep(0.0075)
with suppress(Exception):
for i in range(5):
if self.current_url.startswith("chrome-extension://"):
for window_handle in self.window_handles:
self.switch_to.window(window_handle)
if self.current_url.startswith(
"chrome-extension://"
):
self.close()
if self.service.is_connectable():
self.stop_client()
self.service.stop()
self.service.start()
self.start_session()
time.sleep(0.0075)
else:
break
time.sleep(0.003)
with suppress(Exception):
self.switch_to.window(self.window_handles[-1])
self._is_connected = True

def start_session(self, capabilities=None):
5 changes: 3 additions & 2 deletions seleniumbase/undetected/webelement.py
Original file line number Diff line number Diff line change
@@ -26,10 +26,11 @@ def uc_click(
driver.js_click(selector, by=by, timeout=1)
else:
super().click()
driver = self._parent
if not reconnect_time:
self._parent.reconnect(0.5)
driver.reconnect(0.5)
else:
self._parent.reconnect(reconnect_time)
driver.reconnect(reconnect_time)

def uc_reconnect(self, reconnect_time=None):
if not reconnect_time: